time() function in C Last Updated : 10 Jan, 2025 Comments Improve Suggest changes Like Article Like Report The time() function is defined in time.h (ctime in C++) header file. This function returns the time since 00:00:00 UTC, January 1, 1970 (Unix timestamp) in seconds. If second is not a null pointer, the returned value is also stored in the object pointed to by second.Syntax: time_t time( time_t *second )Parameter: This function accepts single parameter second. This parameter is used to set the time_t object which store the time.Return Value: This function returns current calendar time as a object of type time_t.Time Complexity: O(1)Auxiliary Space: O(1)Program 1: C // C program to demonstrate // example of time() function. #include <stdio.h> #include <time.h> int main () { time_t seconds; seconds = time(NULL); printf("Seconds since January 1, 1970 = %ld\n", seconds); return(0); } OutputSeconds since January 1, 1970 = 1538123990Example 2: C // C program to demonstrate // example of time() function. #include <stdio.h> #include <time.h> int main() { time_t seconds; // Stores time seconds time(&seconds); printf("Seconds since January 1, 1970 = %ld\n", seconds); return 0; } OutputSeconds since January 1, 1970 = 1538123990 C Program to print digital clock with current time Comment More infoAdvertise with us Next Article sin() in C B bansal_rtk_ Follow Improve Article Tags : Misc C Programs C Language C-Functions C-Library +1 More Practice Tags : Misc Similar Reads C Library Functions The Standard Function Library in C is a huge library of sub-libraries, each of which contains the code for several functions. In order to make use of these libraries, link each library in the broader library through the use of header files. The actual definitions of these functions are stored in sep 9 min read sin() in C The sin() function in C is a standard library function to find the sine value of the radian angle. It is used to evaluate the trigonometric sine function of an angle. It takes the radian angle as input and returns the sin of that angle. It is defined inside <math.h> header file. Syntax of sin( 1 min read Measure execution time with high precision in C/C++ Execution time : The execution time or CPU time of a given task is defined as the time spent by the system executing that task in other way you can say the time during which a program is running. There are multiple way to measure execution time of a program, in this article i will discuss 5 differen 8 min read Measure execution time with high precision in C/C++ Execution time : The execution time or CPU time of a given task is defined as the time spent by the system executing that task in other way you can say the time during which a program is running. There are multiple way to measure execution time of a program, in this article i will discuss 5 differen 8 min read Measure execution time with high precision in C/C++ Execution time : The execution time or CPU time of a given task is defined as the time spent by the system executing that task in other way you can say the time during which a program is running. There are multiple way to measure execution time of a program, in this article i will discuss 5 differen 8 min read time.h header file in C with Examples The time.h header file contains definitions of functions to get and manipulate date and time information. It also includes functions, types, and macros, which are used by programs to measure time, manipulate dates, and format time information. It describes three time-related data types. clock_t: clo 6 min read Like