Mail Archives: djgpp/1999/08/01/22:21:57
/* getting DJGPP to print out a
formatted Date/Time string
(ie, like Borlands lazy strdate() and strtime())
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
struct tm *time_now;
time_t secs_now;
//Copied from LIBC.HLP file.
/* time_t mktime(struct tm *tptr); */
/* time_t time(time_t *t); */
/* struct tm *localtime(const time_t *tod); */
int main(int argc, char **argv) {
char buf[100];
time_now = localtime(&secs_now);
strftime(buf, 100, "%B %d, %Y", time_now);
printf("%s\n", buf);
}
------------------
Outputs:
January 01, 1970
------------------
How do I get a PROPER Date/Time (like from the system clock)?
- Raw text -