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 Comment More infoAdvertise with us Next Article time() function in C bansal_rtk_ Follow Improve Article Tags : Misc C Programs C Language C-Functions C-Library +1 More Practice Tags : Misc Similar Reads tan() Function in C tan() function in C programming is provided by the math.h header file and it is used to calculate the tangent of an angle x where x is represented in radians. This function returns the tangent of a given angle value in radians and it only works for right-angled triangles. Syntax of tan() double tan( 2 min read sqrt() Function in C sqrt() function in C is a predefined function in the math.h library used to calculate the square root of a given number. To use this function, we must include the <math.h> header file in our program. It returns the square root of the number as a double and works with double data types, for oth 3 min read 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 time.h localtime() function in C with Examples The localtime() function is defined in the time.h header file. The localtime( ) function return the local time of the user i.e time present at the task bar in computer. Syntax: tm* localtime(const time_t* t_ptr); Parameter: This function accepts a parameter t_ptr which represents the pointer to time 1 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 Like