Document creation date.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 27 May 2017 18:14:51 +0000 (11:14 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 27 May 2017 18:14:51 +0000 (11:14 -0700)
dump.c
spv-file-format.texi

diff --git a/dump.c b/dump.c
index 1b7a8ed8e78c5ddd68affbf69ccc3ede8b55e8fa..212421cb8045f5d330129c1882745abe1ae4388c 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <time.h>
 #include <unistd.h>
 #include "u8-mbtouc.h"
 
@@ -1138,7 +1139,13 @@ dump_fonts(void)
               printf("<datafile>%s</datafile>\n", get_string());
 
               match_u32_assert(0);
-              get_u32();
+
+              time_t date = get_u32();
+              struct tm tm = *localtime(&date);
+              char s[128];
+              strftime(s, sizeof s, "%a, %d %b %Y %H:%M:%S %z", &tm);
+              printf("<date>%s</date>\n", s);
+
               match_u32_assert(0);
             }
         }
index 192c1c3ea1384534518ece495cbbb3536463cf56..c5d327407feb24465714e5fa51b162d7ae7a624d 100644 (file)
@@ -903,8 +903,8 @@ X6 @result{}
     (00 @math{|} 01) 00 (00 @math{|} 01) (00 @math{|} 01)
     int[@t{epoch}]
     byte[@t{decimal}] byte[@t{grouping}]
-    byte*8 01
-    (string[@t{dataset}] string[@t{data file}] i0 int i0)?
+    (2d 43 1c eb e2 36 1a 3f | 00*8) 01
+    (string[@t{dataset}] string[@t{datafile}] i0 int[@t{date}] i0)?
     int[@t{n-ccs}] string*[@t{n-ccs}]
     2e (00 @math{|} 01) (i2000000 i0)?
 @end format
@@ -921,7 +921,7 @@ encoding string is itself encoded in US-ASCII.
 @code{epoch} is the year that starts the epoch.  A 2-digit year is
 interpreted as belonging to the 100 years beginning at the epoch.  The
 default epoch year is 69 years prior to the current year; thus, in
-2017 this field by default contains 1948.  In the corpus, @t{epoch}
+2017 this field by default contains 1948.  In the corpus, @code{epoch}
 ranges from 1943 to 1948, plus some contain -1.
 
 @code{decimal} is the decimal point character.  The observed values
@@ -932,6 +932,22 @@ are @samp{.} and @samp{,}.
 @samp{'} (apostrophe), @samp{ } (space), and zero (presumably
 indicating that digits should not be grouped).
 
+@code{dataset} is the name of the dataset analyzed to produce the
+output, e.g.@: @code{DataSet1}, and @code{datafile} the name of the
+file it was read from, e.g.@: @file{C:\Users\foo\bar.sav}.  The latter
+is sometimes the empty string.
+
+@code{date} is a date, as seconds since the epoch, i.e.@: since
+January 1, 1970.  Pivot tables within an SPV files often have dates a
+few minutes apart, so this is probably a creation date for the tables
+rather than for the file.
+
+Sometimes @code{dataset}, @code{datafile}, and @code{date} are present
+and other times they are absent.  The reader can distinguish by
+assuming that they are present and then checking whether the
+presumptive @code{dataset} contains a null byte (a valid string never
+will).
+
 @code{n-ccs} is observed as either 0 or 5.  When it is 5, the
 following strings are CCA through CCE format strings.  @xref{Custom
 Currency Formats,,, pspp, PSPP}.  Most commonly these are all