GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing en.wikipedia.org — C date and time functions - Wikipedia (Redirected from Time.h)
The C date and time functions are a group of functions in the standard library of the C programming language implementing date and time manipulation operations.[1] They provide support for time acquisition, conversion between date formats, and formatted output to strings. HistoryThe format string used in Overview of functionsThe C date and time operations are defined in the
The ExampleThe following C source code prints the current time to the standard output stream. #include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { // Obtain current time. time_t current_time = time(NULL); if (current_time == (time_t)-1) { fprintf(stderr, "Failure to obtain the current time.\n"); return EXIT_FAILURE; } // Convert to local time format. char* time_string = ctime(¤t_time); if (!time_string) { fprintf(stderr, "Failure to convert the current time.\n"); return EXIT_FAILURE; } // Print to stdout. ctime() has already added a terminating newline character. printf("Current time is %s", time_string); return EXIT_SUCCESS; } The output is: Current time is Thu Sep 15 21:18:23 2016
See alsoReferences
External linksThe Wikibook C Programming has a page on the topic of: C Programming/C Reference | |||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |