First public contribution.
1 /** @file ../include/sys/time.h
5 /** @fn adjtime(const struct timeval *delta, struct timeval *olddelta)
8 @return A successful call will return 0 while a failure will return -1
12 The adjtime system call makes small adjustments to the system time (as
13 returned by gettimeofday ) by advancing it the amount
14 specified by the timeval delta .
16 If delta is negative, the clock is still incremented by the positive of
17 delta until the correction is complete. Thus, the time is always a monotonically
18 increasing function and time correction from an earlier call to adjtime might not have finished when adjtime is called again. In such cases the structure pointed to by olddelta will contain, upon return, the number of microseconds still
19 to be corrected from the earlier call. Otherwise the values will be set to 0
21 This call may be used by time servers that synchronize the clock.
29 //Fill the input struct with 100 microseconds
30 const struct timeval delta = {0, 100};
31 struct timeval olddelta;
33 retval = adjtime (δ, &olddelta;); //Call adjtime
34 printf("adjtime returned %d",retval);
53 /** @fn gettimeofday(struct timeval *tp, struct timezone *tzp)
56 @return The gettimeofday function returns 0 for success, or -1 for failure.
58 The system's notion of the current Greenwich time and the current time
59 zone is obtained with the gettimeofday system call, and set with the settimeofday system call.
60 The time is expressed in seconds and microseconds
61 since midnight (0 hour), January 1, 1970.
62 The resolution of the system
63 clock is hardware dependent, and the time may be updated continuously or
65 If tp or tzp is NULL, the associated time
66 information will not be returned or set.
68 The structures pointed to by tp and tzp are defined in \#include \<sys/time.h\> as:
72 longtv_sec;/* seconds since Jan. 1, 1970 */
73 longtv_usec;/* and microseconds */
79 inttz_minuteswest; /* minutes west of Greenwich */
80 inttz_dsttime;/* type of dst correction */
84 The timezone structure indicates the local time zone (measured in minutes of time
85 westward from Greenwich) and a flag that, if nonzero, indicates that Daylight
86 Saving time applies locally during the appropriate part of the year.
97 int i = gettimeofday(tv, tz);
99 printf("tv: %d, %d", tv->tv_sec, tv->tv_usec);
100 printf("tz: %d, %d", tz->tz_minuteswest, tz->tz_dsttime);
107 tv: 1474660693, -326937770
119 @externallyDefinedApi
122 /** @fn utimes(const char *filename, const struct timeval *tvp)
126 Note: This description also covers the following functions -
129 @return Upon successful completion, the value 0 is returned; otherwise the
130 value -1 is returned and the global variable errno is set to indicate the
133 The utimes function sets the access and modification times of the file pointed
134 to by the path argument to the value of the times argument.
135 The utimes function allows time specifications accurate to the microsecond.
137 For utimes , the times argument is an array of timeval structures. The first array
138 member represents the date and time of last access and the second member represents the date and time of last modification.
139 The times in the timeval structure are measured in seconds and microseconds since the Epoch, although rounding toward
140 the nearest second may occur.
142 If the times argument is a null pointer, the access and modification times
143 of the file are set to the current time.
147 /* Detailed description: Sample usage of utimes system call.
148 * Preconditions: Example.txt file should exist in the working directory
150 #include <sys/types.h>
152 #include <sys/time.h>
155 struct timeval Tim[1] ;
158 if(utimes("Example.txt" , Tim) < 0 )
160 printf("Utimes system call failed") ;
163 printf("Utimes call succeded") ;
173 @capability Deferred @ref RFs::SetModified(const TDesC16&, const TTime&)
176 @externallyDefinedApi
180 /** @fn bintime_addx(struct bintime *bt, uint64_t x)
182 Static inline funtion. Function for reading the time.
188 /** @fn bintime_add(struct bintime *bt, const struct bintime *bt2)
190 Static inline funtion. Function for reading the time.
196 /** @fn bintime_sub(struct bintime *bt, const struct bintime *bt2)
198 Static inline funtion. Function for reading the time.
205 /** @fn bintime2timespec(const struct bintime *bt, struct timespec *ts)
207 Static inline funtion
213 /** @fn timespec2bintime(const struct timespec *ts, struct bintime *bt)
215 Static inline funtion
221 /** @fn bintime2timeval(const struct bintime *bt, struct timeval *tv)
223 Static inline funtion
230 /** @fn timeval2bintime(const struct timeval *tv, struct bintime *bt)
232 Static inline funtion
238 /** @struct itimerval
240 Includes the following members,
243 @externallyDefinedApi
246 /** @var itimerval::it_interval
250 /** @var itimerval::it_value
254 /** @struct clockinfo
256 Getkerninfo clock information structure
259 @externallyDefinedApi
262 /** @var clockinfo::hz
266 /** @var clockinfo::tick
267 micro-seconds per hz tick
270 /** @var clockinfo::spare
274 /** @var clockinfo::stathz
275 statistics clock frequency
278 /** @var clockinfo::profhz
279 profiling clock frequency