* elf/Makefile (ld.so): Adjust the sed script to insert _begin in to
[glibc.git] / manual / examples / strftim.c
blob7f95ef02adaa14bcf8a956affc6b9cfd7413697b
1 #include <time.h>
2 #include <stdio.h>
4 #define SIZE 256
6 int
7 main (void)
9 char buffer[SIZE];
10 time_t curtime;
11 struct tm *loctime;
13 /* Get the current time. */
14 curtime = time (NULL);
16 /* Convert it to local time representation. */
17 loctime = localtime (&curtime);
19 /* Print out the date and time in the standard format. */
20 fputs (asctime (loctime), stdout);
22 /*@group*/
23 /* Print it out in a nice format. */
24 strftime (buffer, SIZE, "Today is %A, %B %d.\n", loctime);
25 fputs (buffer, stdout);
26 strftime (buffer, SIZE, "The time is %I:%M %p.\n", loctime);
27 fputs (buffer, stdout);
29 return 0;
31 /*@end group*/