time function(Current Time) in C Language – example and detail

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


The syntax for the time characteristic 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 now not a null pointer, the time function will save the calendar time in timer.


The time characteristic returns the modern-day calendar time.

If timer is not a null pointer, the time feature will shop the calendar time in timer.

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

Required Header

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

#include <time.h>

Applies To

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

ANSI/ISO 9899-1990

Similar Functions

Other C functions that are comparable to the time function:

asctime function clock function ctime feature difftime characteristic gmtime characteristic localtime characteristic mktime characteristic strftime characteristic