rust: Allow creation date in system files to contain dashes.
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 15 Sep 2025 19:51:19 +0000 (12:51 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 17 Sep 2025 15:17:52 +0000 (08:17 -0700)
rust/doc/src/system-file.md
rust/pspp/src/sys/cooked.rs

index 06767966cef655cddfb6323954d9542bbfe10eed..4e23a04fc7c05ee8405bf7ce59654ad1b4e6b6fd 100644 (file)
@@ -263,14 +263,14 @@ A system file begins with the file header, with the following format:
 
   Date of creation of the system file, in `dd mmm yy` format, with
   the month as standard English abbreviations, using an initial
-  capital letter and following with lowercase.  If the date is not
-  available then this field is arbitrarily set to `01 Jan 70`.
+  capital letter and following with lowercase.
+
+  > Some files in the corpus have the date in `dd-mmm-yy` format.
 
 * `char creation_time[8];`
 
   Time of creation of the system file, in `hh:mm:ss` format and using
-  24-hour time.  If the time is not available then this field is
-  arbitrarily set to `00:00:00`.
+  24-hour time.
 
 * `char file_label[64];`
 
index abb18fd5996f5c5655786b0a0bc77d7bc143c25f..5702522ec978270fceda22a45d7b402e611561f6 100644 (file)
@@ -1474,6 +1474,7 @@ impl Metadata {
     fn decode(header: &FileHeader<String>, headers: &Records, mut warn: impl FnMut(Error)) -> Self {
         let header = &header;
         let creation_date = NaiveDate::parse_from_str(&header.creation_date, "%e %b %y")
+            .or_else(|_| NaiveDate::parse_from_str(&header.creation_date, "%e-%b-%y"))
             .unwrap_or_else(|_| {
                 warn(Error::InvalidCreationDate(header.creation_date.to_string()));
                 Default::default()