# libc - Simple Calendar Time

File: libc.info | Node: Simple Calendar Time | Next: High-Resolution Calendar | Up: Calendar Time

### Simple Calendar Time

This section describes the `time_t' data type for representing calendar time, and the functions which operate on calendar time objects. These facilities are declared in the header file `time.h'.

-- Data Type: time_t
  This is the data type used to represent calendar time. In the GNU C library and other POSIX-compliant implementations, `time_t' is equivalent to `long int'. When interpreted as an absolute time value, it represents the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time. (This date is sometimes referred to as the "epoch".)

  In other systems, `time_t' might be either an integer or floating-point type.

--Function: double difftime (time_t TIME1, time_t TIME0)
  The `difftime' function returns the number of seconds elapsed between time TIME1 and time TIME0, as a value of type `double'.

  In the GNU system, you can simply subtract `time_t' values. But on other systems, the `time_t' data type might use some other encoding where subtraction doesn't work directly.

--Function: time_t time (time_t *RESULT)
  The `time' function returns the current time as a value of type `time_t'. If the argument RESULT is not a null pointer, the time value is also stored in `*RESULT'. If the calendar time is not available, the value `(time_t)(-1)' is returned.

Next: High-Resolution Calendar | Up: Calendar Time

converted by gnuinfo

Main page of this Linux-oriented web server

This server is maintained by VH