X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=dump%2Fitime.c;h=7b20ca216bd08908576b1cd96f46e9c23ef8096a;hp=aeaaec01f8f9ee8c92ed88d717b398956cc4cdf4;hb=3458b64d0f4e9c6b5bf43ba51c964bab8b716127;hpb=cdef84caee08a2436de99fc3e6f5d8eeb3635072 diff --git a/dump/itime.c b/dump/itime.c index aeaaec0..7b20ca2 100644 --- a/dump/itime.c +++ b/dump/itime.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: itime.c,v 1.23 2002/08/01 10:23:26 stelian Exp $"; + "$Id: itime.c,v 1.24 2003/03/06 14:35:51 stelian Exp $"; #endif /* not lint */ #include @@ -259,11 +259,21 @@ putdumptime(void) static void dumprecout(FILE *file, struct dumpdates *what) { + char buf[26]; + struct tm *tms; - if (fprintf(file, "%s %c %s", + tms = localtime(&what->dd_ddate); + strncpy(buf, asctime(tms), sizeof(buf)); + if (buf[24] != '\n' || buf[25] != '\0') + quit("asctime returned an unexpected string\n"); + buf[24] = 0; + if (fprintf(file, "%s %c %s %c%2.2d%2.2d\n", what->dd_name, what->dd_level, - ctime(&what->dd_ddate)) < 0) + buf, + (tms->tm_gmtoff < 0 ? '-' : '+'), + abs(tms->tm_gmtoff) / 3600, + abs(tms->tm_gmtoff) % 3600 / 60) < 0) quit("%s: %s\n", dumpdates, strerror(errno)); }