]> git.wh0rd.org - dump.git/blobdiff - dump/itime.c
Relicensed dump/restore under the revised BSD license, as per ftp://ftp.cs.berkeley...
[dump.git] / dump / itime.c
index aeaaec01f8f9ee8c92ed88d717b398956cc4cdf4..6f59a8502979bdd48993cc8188419265068bf03d 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -41,7 +37,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.25 2003/03/30 15:40:36 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -259,11 +255,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));
 }