Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <time.h>
Link against: libc.lib

bintime_addx(struct bintime *,uint64_t)

static inline void bintime_addx(struct bintime *bt, uint64_t x);

Description

Static inline funtion. Function for reading the time.

Parameters

struct bintime *bt

uint64_tuint64_t x

[Top]


bintime_add(struct bintime *,const struct bintime *)

static inline void bintime_add(struct bintime *bt, const struct bintime *bt2);

Description

Static inline funtion. Function for reading the time.

Parameters

struct bintime *bt

const struct bintime *bt2

[Top]


bintime_sub(struct bintime *,const struct bintime *)

static inline void bintime_sub(struct bintime *bt, const struct bintime *bt2);

Description

Static inline funtion. Function for reading the time.

Parameters

struct bintime *bt

const struct bintime *bt2

[Top]


bintime2timespec(const struct bintime *,struct timespec *)

static inline void bintime2timespec(const struct bintime *bt, struct timespec *ts);

Description

Static inline funtion

Parameters

const struct bintime *bt

struct timespectimespec *ts

[Top]


timespec2bintime(const struct timespec *,struct bintime *)

static inline void timespec2bintime(const struct timespec *ts, struct bintime *bt);

Description

Static inline funtion

Parameters

const struct timespectimespec *ts

struct bintime *bt

[Top]


bintime2timeval(const struct bintime *,struct timeval *)

static inline void bintime2timeval(const struct bintime *bt, struct timeval *tv);

Description

Static inline funtion

Parameters

const struct bintime *bt

struct timevaltimeval *tv

[Top]


timeval2bintime(const struct timeval *,struct bintime *)

static inline void timeval2bintime(const struct timeval *tv, struct bintime *bt);

Description

Static inline funtion

Parameters

const struct timevaltimeval *tv

struct bintime *bt

[Top]


adjtime(const struct timeval *,struct timeval *)

Interface status: externallyDefinedApi

IMPORT_C int adjtime(const struct timeval *, struct timeval *);

Description

The adjtime system call makes small adjustments to the system time (as returned by gettimeofday ) by advancing it the amount specified by the timeval delta .

If delta is negative, the clock is still incremented by the positive of delta until the correction is complete. Thus, the time is always a monotonically 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 to be corrected from the earlier call. Otherwise the values will be set to 0

This call may be used by time servers that synchronize the clock.

Examples:

#include <sys/time.h>
#include <stdio.h>
int main()
{
        //Fill the input struct with 100 microseconds
        const struct timeval delta = {0, 100};
        struct timeval  olddelta;
        int retval;
        retval = adjtime (&delta;, &olddelta;); //Call adjtime
        printf("adjtime returned %d",retval);
        return 0;
}

Output

adjtime returned 0

Parameters

const struct timevaltimeval *

struct timevaltimeval *

Return value

int

A successful call will return 0 while a failure will return -1

See also:

[Top]


gettimeofday(struct timeval *,struct timezone *)

Interface status: externallyDefinedApi

IMPORT_C int gettimeofday(struct timeval *, struct timezone *);

Description

The system's notion of the current Greenwich time and the current time zone is obtained with the gettimeofday system call, and set with the settimeofday system call. The time is expressed in seconds and microseconds since midnight (0 hour), January 1, 1970. The resolution of the system clock is hardware dependent, and the time may be updated continuously or in "ticks." If tp or tzp is NULL, the associated time information will not be returned or set.

The structures pointed to by tp and tzp are defined in #include <sys/time.h> as:

struct timeval {
longtv_sec;/* seconds since Jan. 1, 1970 */
longtv_usec;/* and microseconds */
};
struct timezone {
inttz_minuteswest; /* minutes west of Greenwich */
inttz_dsttime;/* type of dst correction */
};

The timezone structure indicates the local time zone (measured in minutes of time westward from Greenwich) and a flag that, if nonzero, indicates that Daylight Saving time applies locally during the appropriate part of the year.

Examples:

# 90 "d:/EPOC/release/9.4/common/generic/openenv/core/include/sys/time.dosc" 2
# 91 "d:/EPOC/release/9.4/common/generic/openenv/core/include/sys/time.dosc" 2
 
int main()
{
  struct timeval *tv;
  struct timezone *tz;
  int i = gettimeofday(tv, tz);
      
  printf("tv: %d, %d", tv->tv_sec, tv->tv_usec);
  printf("tz: %d, %d", tz->tz_minuteswest, tz->tz_dsttime);
  return 0;
}

Output

tv: 1474660693, -326937770
tz: 7804688, 3

Parameters

struct timevaltimeval *

struct timezonetimezone *

Return value

int

The gettimeofday function returns 0 for success, or -1 for failure.

See also:

[Top]


utimes(const char *,const struct timeval *)

Interface status: externallyDefinedApi

IMPORT_C int utimes(const char *, const struct timeval *);

Description

The utimes function sets the access and modification times of the file pointed to by the path argument to the value of the times argument. The utimes function allows time specifications accurate to the microsecond.

For utimes , the times argument is an array of timeval structures. The first array member represents the date and time of last access and the second member represents the date and time of last modification. The times in the timeval structure are measured in seconds and microseconds since the Epoch, although rounding toward the nearest second may occur.

If the times argument is a null pointer, the access and modification times of the file are set to the current time.

Examples:

/*  Detailed description: Sample usage of utimes system call.
  Preconditions: Example.txt file should exist in the working directory
 */
# 150 "d:/EPOC/release/9.4/common/generic/openenv/core/include/sys/time.dosc" 2
# 151 "d:/EPOC/release/9.4/common/generic/openenv/core/include/sys/time.dosc" 2
# 152 "d:/EPOC/release/9.4/common/generic/openenv/core/include/sys/time.dosc" 2
int main()
{
  struct timeval Tim[1] ;
 Tim[0].tv_sec = 0 ;
 Tim[0].tv_usec = 0 ;
  if(utimes("Example.txt"  , Tim) < 0 )
  {
     printf("Utimes system call failed") ;
     return -1 ;
  }
  printf("Utimes call succeded") ;
 return 0 ;
}

Parameters

const char *

const struct timevaltimeval *

Note: This description also covers the following functions - lutimes() futimes()

Return value

int

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

See also: