genericopenlibs/openenvcore/include/sys/time.dosc
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /** @file  ../include/sys/time.h
       
     2 @internalComponent
       
     3 */
       
     4 
       
     5 /** @fn  adjtime(const struct timeval *delta, struct timeval *olddelta)
       
     6 @param delta
       
     7 @param olddelta
       
     8 @return   A successful call will return 0 while a failure will return -1
       
     9 
       
    10  
       
    11 
       
    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 .
       
    15 
       
    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
       
    20 
       
    21  This call may be used by time servers that synchronize the clock.
       
    22 
       
    23 Examples:
       
    24 @code
       
    25 #include <sys/time.h>
       
    26 #include <stdio.h>
       
    27 int main()
       
    28 {
       
    29         //Fill the input struct with 100 microseconds
       
    30         const struct timeval delta = {0, 100};
       
    31         struct timeval  olddelta;
       
    32         int retval;
       
    33         retval = adjtime (&delta;, &olddelta;); //Call adjtime
       
    34         printf("adjtime returned %d",retval);
       
    35         return 0;
       
    36 }
       
    37 
       
    38 @endcode
       
    39  Output
       
    40 @code
       
    41 adjtime returned 0
       
    42 
       
    43 @endcode
       
    44 @see gettimeofday()
       
    45 
       
    46 
       
    47  
       
    48 
       
    49 @publishedAll
       
    50 @externallyDefinedApi
       
    51 */
       
    52 
       
    53 /** @fn  gettimeofday(struct timeval *tp, struct timezone *tzp)
       
    54 @param tp
       
    55 @param tzp
       
    56 @return   The gettimeofday function returns 0 for success, or -1  for  failure.
       
    57 
       
    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
       
    64 in "ticks."
       
    65 If tp or tzp is NULL, the associated time
       
    66 information will not be returned or set.
       
    67 
       
    68  The structures pointed to by tp and tzp are defined in \#include \<sys/time.h\> as:
       
    69 
       
    70 @code
       
    71 struct timeval {
       
    72 longtv_sec;/* seconds since Jan. 1, 1970 */
       
    73 longtv_usec;/* and microseconds */
       
    74 };
       
    75 @endcode
       
    76 
       
    77 @code
       
    78 struct timezone {
       
    79 inttz_minuteswest; /* minutes west of Greenwich */
       
    80 inttz_dsttime;/* type of dst correction */
       
    81 };
       
    82 @endcode
       
    83 
       
    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.
       
    87 
       
    88 Examples:
       
    89 @code
       
    90 #include <stdio.h>
       
    91 #include <sys/time.h>
       
    92  
       
    93 int main()
       
    94 {
       
    95   struct timeval *tv;
       
    96   struct timezone *tz;
       
    97   int i = gettimeofday(tv, tz);
       
    98       
       
    99   printf("tv: %d, %d", tv->tv_sec, tv->tv_usec);
       
   100   printf("tz: %d, %d", tz->tz_minuteswest, tz->tz_dsttime);
       
   101   return 0;
       
   102 }
       
   103 
       
   104 @endcode
       
   105  Output
       
   106 @code
       
   107 tv: 1474660693, -326937770
       
   108 tz: 7804688, 3
       
   109 
       
   110 @endcode
       
   111 @see adjtime()
       
   112 @see clock_gettime()
       
   113 @see ctime()
       
   114 
       
   115 
       
   116  
       
   117 
       
   118 @publishedAll
       
   119 @externallyDefinedApi
       
   120 */
       
   121 
       
   122 /** @fn  utimes(const char *filename, const struct timeval *tvp)
       
   123 @param filename
       
   124 @param tvp
       
   125 
       
   126 Note: This description also covers the following functions -
       
   127  lutimes()  futimes() 
       
   128 
       
   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
       
   131 error.
       
   132 
       
   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.
       
   136 
       
   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.
       
   141 
       
   142  If the times argument is a null pointer, the access and modification times 
       
   143   of the file are set to the current time.
       
   144 
       
   145 Examples:
       
   146 @code
       
   147 /*  Detailed description: Sample usage of utimes system call.
       
   148  *  Preconditions: Example.txt file should exist in the working directory
       
   149  */
       
   150 #include <sys/types.h>
       
   151 #include <utime.h>
       
   152 #include <sys/time.h>
       
   153 int main()
       
   154 {
       
   155   struct timeval Tim[1] ;
       
   156  Tim[0].tv_sec = 0 ;
       
   157  Tim[0].tv_usec = 0 ;
       
   158   if(utimes("Example.txt"  , Tim) < 0 )
       
   159   {
       
   160      printf("Utimes system call failed") ;
       
   161      return -1 ;
       
   162   }
       
   163   printf("Utimes call succeded") ;
       
   164  return 0 ;
       
   165 }
       
   166 
       
   167 @endcode
       
   168 @see stat()
       
   169 @see utime()
       
   170 
       
   171 
       
   172 
       
   173 @capability Deferred @ref RFs::SetModified(const TDesC16&, const TTime&)
       
   174 
       
   175 @publishedAll
       
   176 @externallyDefinedApi
       
   177 */
       
   178 
       
   179 
       
   180 /** @fn bintime_addx(struct bintime *bt, uint64_t x)
       
   181 
       
   182 Static inline funtion. Function for reading the time.
       
   183 
       
   184 @publishedAll
       
   185 @released
       
   186 */
       
   187 
       
   188 /** @fn  bintime_add(struct bintime *bt, const struct bintime *bt2)
       
   189 
       
   190 Static inline funtion. Function for reading the time.
       
   191 
       
   192 @publishedAll
       
   193 @released
       
   194 */
       
   195 
       
   196 /** @fn  bintime_sub(struct bintime *bt, const struct bintime *bt2)
       
   197 
       
   198 Static inline funtion. Function for reading the time.
       
   199 
       
   200 @publishedAll
       
   201 @released
       
   202 */
       
   203 
       
   204 
       
   205 /** @fn bintime2timespec(const struct bintime *bt, struct timespec *ts)
       
   206 
       
   207 Static inline funtion
       
   208 
       
   209 @publishedAll
       
   210 @released
       
   211 */
       
   212 
       
   213 /** @fn  timespec2bintime(const struct timespec *ts, struct bintime *bt)
       
   214 
       
   215 Static inline funtion
       
   216 
       
   217 @publishedAll
       
   218 @released
       
   219 */
       
   220 
       
   221 /** @fn  bintime2timeval(const struct bintime *bt, struct timeval *tv)
       
   222 
       
   223 Static inline funtion
       
   224 
       
   225 @publishedAll
       
   226 @released
       
   227 */
       
   228 
       
   229 
       
   230 /** @fn timeval2bintime(const struct timeval *tv, struct bintime *bt)
       
   231 
       
   232 Static inline funtion
       
   233 
       
   234 @publishedAll
       
   235 @released
       
   236 */
       
   237 
       
   238 /** @struct itimerval 
       
   239 
       
   240 Includes the following members,
       
   241 
       
   242 @publishedAll
       
   243 @externallyDefinedApi
       
   244 */
       
   245 
       
   246 /** @var itimerval::it_interval
       
   247 timer interval
       
   248 */
       
   249 
       
   250 /** @var itimerval::it_value
       
   251 current value 
       
   252 */
       
   253 
       
   254 /** @struct clockinfo 
       
   255 
       
   256 Getkerninfo clock information structure
       
   257 
       
   258 @publishedAll
       
   259 @externallyDefinedApi
       
   260 */
       
   261 
       
   262 /** @var clockinfo::hz
       
   263 clock frequency 
       
   264 */
       
   265 
       
   266 /** @var clockinfo::tick
       
   267 micro-seconds per hz tick
       
   268 */
       
   269 
       
   270 /** @var clockinfo::spare
       
   271 current value 
       
   272 */
       
   273 
       
   274 /** @var clockinfo::stathz
       
   275 statistics clock frequency
       
   276 */
       
   277 
       
   278 /** @var clockinfo::profhz
       
   279 profiling clock frequency
       
   280 */
       
   281 
       
   282 
       
   283 
       
   284