This section describes the time_t data type for representing calendar
time as simple time, and the functions which operate on simple time objects.
These facilities are declared in the header file `time.h'.
TZ to certain values (see section Specifying the Time Zone with TZ).
Note that a simple time has no concept of local time zone. Calendar Time T is the same instant in time regardless of where on the globe the computer is.
In the GNU C library, time_t is equivalent to long int.
In other systems, time_t might be either an integer or
floating-point type.
The function difftime tells you the elapsed time between two
simple calendar times, which is not always as easy to compute as just
subtracting. See section Elapsed Time.
time function returns the current calendar time as a value of
type time_t. If the argument result is not a null pointer,
the calendar time value is also stored in *result. If the
current calendar time is not available, the value
(time_t)(-1) is returned.
stime sets the system clock, i.e. it tells the system that the
current calendar time is newtime, where newtime is
interpreted as described in the above definition of time_t.
settimeofday is a newer function which sets the system clock to
better than one second precision. settimeofday is generally a
better choice than stime. See section High-Resolution Calendar.
Only the superuser can set the system clock.
If the function succeeds, the return value is zero. Otherwise, it is
-1 and errno is set accordingly:
EPERM
Go to the first, previous, next, last section, table of contents.