totn C Functions

C Language: time function
(Current Time)

In the C Programming Language, the time function returns the current calendar time.

Syntax

The syntax for the time function in the C Language is:

time_t time(time_t *timer);

Parameters or Arguments

timer
A pointer. timer can be a null pointer. If timer is not a null pointer, the time function will store the calendar time in timer.

Returns

The time function returns the current calendar time.

If timer is not a null pointer, the time function will store the calendar time in timer.

If there is an error (ie: the time is unavailable), the time function will return -1.

Required Header

In the C Language, the required header for the time function is:

#include <time.h>

Applies To

In the C Language, the time function can be used in the following versions:

  • ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the time function: