Changing what time a process thinks it is with libfaketime


 
Thread Tools Search this Thread
Special Forums News, Links, Events and Announcements UNIX and Linux RSS News Changing what time a process thinks it is with libfaketime
# 1  
Old 09-22-2008
Changing what time a process thinks it is with libfaketime

09-22-2008 08:00 AM
With libfaketime you can tell a process that the current time is something different from the machine's system clock. This fake time setting affects not only the functions directly related to reading the system time, but also file timestamps such as modification times. With libfaketime you can test how a program will respond when it is running in the future or in a different timezone without having to change your machine's system clock. Timezone testing can be useful for network applications where a certificate may have already expired in a given timezone but might still work in your local environment.



Source...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Changing process id after starting

Hi We are in the situation where we want to start WebSphere using teh default SSL port of 443. In order to do this we can changed the WAS ssl port from 9443 to 443 and start as root. We would prefer not to start as root but the restriction of using ports < 1024 comes into play. We could install... (3 Replies)
Discussion started by: hukcjv
3 Replies

2. Red Hat

Kernel thinks tcp port in use but isnt

I have a RHEL 5.5 system that i see this behavior on: # uname -a Linux myhost 2.6.18-194.17.4.0.1.el5 #1 SMP Tue Oct 26 20:10:33 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux #using netcat to listen to a port tells me its in use. $ nc -l myhostip 33371 nc: Address already in use $ # trying... (4 Replies)
Discussion started by: skkool22
4 Replies

3. UNIX for Dummies Questions & Answers

Changing Password process takes a long time

We are running unix. After a reboot of the server we have found that changing password takes a long time. if type in passwd "username" you can type in the 1st instance of the password , press enter , then it will wait for about 3 minutes before bringing up the confirm password line typing it in... (4 Replies)
Discussion started by: AIXlewis
4 Replies

4. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

Hello All, I have a problem calculating the time difference between start and end timings...! the timings are given by 24hr format.. Start Date : 08/05/10 12:55 End Date : 08/09/10 06:50 above values are in mm/dd/yy hh:mm format. Now the thing is, 7th(08/07/10) and... (16 Replies)
Discussion started by: smarty86
16 Replies

5. UNIX for Dummies Questions & Answers

My directory thinks it's a binary file :(

I can't access the data in one of my directories (Mac OS X 10.6.2 "Snow Leopard", MacBook Pro if that matters). It has set its permissions such that it thinks it is a binary file for some reason. I am not really sure how this happened, but is there a way to reset the first bit of the... (4 Replies)
Discussion started by: slgstevenson
4 Replies

6. Linux

Process start time not showing correct time

Process start time is not showing the correct time: I had started a process on Jun 17th at 23:30:00. Next day morning when I run the command "ps -ef | grep mq", the process is showing the start date of Jun 17th but the start time is 00:16:41 Day/Date is setup correctly on the server. It... (2 Replies)
Discussion started by: hemangjani
2 Replies

7. UNIX for Advanced & Expert Users

Process accounting and Shell process time

Hi All, I am running the following accounting on one of my executable, $ accton /home/myexe-acct $ ./myexe $ accton When I check the process timings I get the below result, Shell process time: 300ms myexe time: 100ms I want to know on why the shell(sh) process is taking so much time... (1 Reply)
Discussion started by: santoshbr4
1 Replies

8. UNIX for Dummies Questions & Answers

how to Decrease priority of a particular process in time of process creation

how to decrease priority of a particular process in time of process creation... and also how to decrease priority of a particular process after process creation.. can any one please help me out... (2 Replies)
Discussion started by: Ramkum
2 Replies

9. UNIX for Advanced & Expert Users

Changing the process owner

How do I change the owner of the process in runtime.I'm working AIX. I would appreciate ,If I get sample scripts. (1 Reply)
Discussion started by: kkb_karthi
1 Replies
Login or Register to Ask a Question
CLOCK_GETCPUCLOCKID(3)					     Linux Programmer's Manual					    CLOCK_GETCPUCLOCKID(3)

NAME
clock_getcpuclockid - obtain ID of a process CPU-time clock SYNOPSIS
#include <time.h> int clock_getcpuclockid(pid_t pid, clockid_t *clock_id); Link with -lrt (only for glibc versions before 2.17). Feature Test Macro Requirements for glibc (see feature_test_macros(7)): clock_getcpuclockid(): _POSIX_C_SOURCE >= 200112L DESCRIPTION
The clock_getcpuclockid() function obtains the ID of the CPU-time clock of the process whose ID is pid, and returns it in the location pointed to by clock_id. If pid is zero, then the clock ID of the CPU-time clock of the calling process is returned. RETURN VALUE
On success, clock_getcpuclockid() returns 0; on error, it returns one of the positive error numbers listed in ERRORS. ERRORS
ENOSYS The kernel does not support obtaining the per-process CPU-time clock of another process, and pid does not specify the calling process. EPERM The caller does not have permission to access the CPU-time clock of the process specified by pid. (Specified in POSIX.1-2001; does not occur on Linux unless the kernel does not support obtaining the per-process CPU-time clock of another process.) ESRCH There is no process with the ID pid. VERSIONS
The clock_getcpuclockid() function is available in glibc since version 2.2. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------------------+---------------+---------+ |Interface | Attribute | Value | +----------------------+---------------+---------+ |clock_getcpuclockid() | Thread safety | MT-Safe | +----------------------+---------------+---------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008. NOTES
Calling clock_gettime(2) with the clock ID obtained by a call to clock_getcpuclockid() with a pid of 0, is the same as using the clock ID CLOCK_PROCESS_CPUTIME_ID. EXAMPLE
The example program below obtains the CPU-time clock ID of the process whose ID is given on the command line, and then uses clock_get- time(2) to obtain the time on that clock. An example run is the following: $ ./a.out 1 # Show CPU clock of init process CPU-time clock for PID 1 is 2.213466748 seconds Program source #define _XOPEN_SOURCE 600 #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <time.h> int main(int argc, char *argv[]) { clockid_t clockid; struct timespec ts; if (argc != 2) { fprintf(stderr, "%s <process-ID> ", argv[0]); exit(EXIT_FAILURE); } if (clock_getcpuclockid(atoi(argv[1]), &clockid) != 0) { perror("clock_getcpuclockid"); exit(EXIT_FAILURE); } if (clock_gettime(clockid, &ts) == -1) { perror("clock_gettime"); exit(EXIT_FAILURE); } printf("CPU-time clock for PID %s is %ld.%09ld seconds ", argv[1], (long) ts.tv_sec, (long) ts.tv_nsec); exit(EXIT_SUCCESS); } SEE ALSO
clock_getres(2), timer_create(2), pthread_getcpuclockid(3), time(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2017-09-15 CLOCK_GETCPUCLOCKID(3)