From d563731845efada15183b9be72061203c4e82105 Mon Sep 17 00:00:00 2001 From: Peter Verthez Date: Sat, 4 Jan 2003 15:23:31 +0000 Subject: [PATCH] Test timestamps in records. --- t/src/gom_write.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/t/src/gom_write.c b/t/src/gom_write.c index 4bfeac5..fd73319 100644 --- a/t/src/gom_write.c +++ b/t/src/gom_write.c @@ -87,11 +87,34 @@ int update_header(char* encoding) } } -int main(int argc, char* argv[]) +int test_timestamps() { - int result; + int result = 0; struct tm* tm_ptr; time_t tval; + /* Make sure we get a reproduceable output, in different timezones */ + tval = TIMESTAMP; + tm_ptr = gmtime(&tval); + tm_ptr->tm_isdst = 0; + tval = mktime(tm_ptr); + result = gom_header_update_timestamp(tval); + + /* Also change timestamp of submitter */ + if (result == 0) { + struct submitter* subm = gom_get_first_submitter(); + if (!subm) + result = 100; + else { + result = gom_update_timestamp(&(subm->change_date), tval); + } + } + + return result; +} + +int main(int argc, char* argv[]) +{ + int result; int total_conv_fails = 0; char* outfilename = NULL; char* infilename = NULL; @@ -225,14 +248,8 @@ int main(int argc, char* argv[]) if (result == 0) result |= update_header(encoding); } - /* Make sure we get a reproduceable output, in different timezones */ - if (result == 0) { - tval = TIMESTAMP; - tm_ptr = gmtime(&tval); - tm_ptr->tm_isdst = 0; - tval = mktime(tm_ptr); - result = gom_header_update_timestamp(tval); - } + if (result == 0) + result |= test_timestamps(); if (result == 0) result |= gom_write_file(gedfilename, &total_conv_fails); if (result == 0 && total_conv_fails == 0) { -- 2.30.2