From 560a739640bb8ab266e1335afb9a8cef9eb4f1aa Mon Sep 17 00:00:00 2001
From: Peter Verthez <Peter.Verthez@advalvas.be>
Date: Mon, 30 Dec 2002 09:31:23 +0000
Subject: [PATCH] Test for update of timestamp.

---
 t/output/write_gom_allged.ged   |   4 ++--
 t/output/write_gom_ansel.ged    |   2 ++
 t/output/write_gom_ascii.ged    |   2 ++
 t/output/write_gom_dates.ged    |   2 ++
 t/output/write_gom_uhlbomcl.ged | Bin 1202 -> 1274 bytes
 t/output/write_gom_uhlcl.ged    | Bin 1200 -> 1272 bytes
 t/output/write_gom_ulhbomcl.ged | Bin 1202 -> 1274 bytes
 t/output/write_gom_ulhc.ged     | Bin 1170 -> 1238 bytes
 t/output/write_gom_ulhcl.ged    | Bin 1200 -> 1272 bytes
 t/output/write_gom_ulhl.ged     | Bin 1170 -> 1238 bytes
 t/output/write_gom_ulhlc.ged    | Bin 1200 -> 1272 bytes
 t/src/gom_write.c               |  11 +++++++++++
 12 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/t/output/write_gom_allged.ged b/t/output/write_gom_allged.ged
index 0fc20a0..e06a2a5 100644
--- a/t/output/write_gom_allged.ged
+++ b/t/output/write_gom_allged.ged
@@ -22,8 +22,8 @@
 3 DATE 1 JAN 1998
 3 COPR Copyright of source data
 1 DEST Destination of transmission
-1 DATE 1 JAN 1998
-2 TIME 13:57:24.80
+1 DATE 9 SEP 2001
+2 TIME 02:46:40
 1 SUBM @SUBMITTER@
 1 SUBN @SUBMISSION@
 1 FILE ALLGED.GED
diff --git a/t/output/write_gom_ansel.ged b/t/output/write_gom_ansel.ged
index d96689f..d5fc983 100644
--- a/t/output/write_gom_ansel.ged
+++ b/t/output/write_gom_ansel.ged
@@ -2,6 +2,8 @@
 1 CHAR ASCII
 1 SOUR GEDCOM_PARSE
 2 VERS 0.20.0
+1 DATE 9 SEP 2001
+2 TIME 02:46:40
 1 SUBM @SUBMITTER@
 1 GEDC
 2 VERS 5.5
diff --git a/t/output/write_gom_ascii.ged b/t/output/write_gom_ascii.ged
index d96689f..d5fc983 100644
--- a/t/output/write_gom_ascii.ged
+++ b/t/output/write_gom_ascii.ged
@@ -2,6 +2,8 @@
 1 CHAR ASCII
 1 SOUR GEDCOM_PARSE
 2 VERS 0.20.0
+1 DATE 9 SEP 2001
+2 TIME 02:46:40
 1 SUBM @SUBMITTER@
 1 GEDC
 2 VERS 5.5
diff --git a/t/output/write_gom_dates.ged b/t/output/write_gom_dates.ged
index 57bd1ee..f7c24b0 100644
--- a/t/output/write_gom_dates.ged
+++ b/t/output/write_gom_dates.ged
@@ -1,6 +1,8 @@
 0 HEAD
 1 CHAR ASCII
 1 SOUR APPROVED_SOURCE_NAME
+1 DATE 9 SEP 2001
+2 TIME 02:46:40
 1 SUBM @SUBMITTER@
 1 GEDC
 2 VERS 5.5
diff --git a/t/output/write_gom_uhlbomcl.ged b/t/output/write_gom_uhlbomcl.ged
index 47621de737afa8c0f5dc6082631af9ec90aeb9f4..cc85a3ab79f3d374f569c0ec81d97f13a2cc5cee 100644
GIT binary patch
delta 72
zcmdnQ`HOQxwXF+-BSQ#-D}w@qB@hP#Sph)Wh`|5|4H<YDxPWX0pbAe0U$80zAm56?
Ngux6%ZY*$O0RX|M3j6>7

delta 10
RcmeyxxruW^^~S^IEC3rc1bF}e

diff --git a/t/output/write_gom_uhlcl.ged b/t/output/write_gom_uhlcl.ged
index 60fb5567227c2a2e2c525b629d70edc7895a9271..c47022d24046f54d3897d002c394b09746d46040 100644
GIT binary patch
delta 72
zcmdnM`Ga#prL7BtBSQ#-D}w@qB@hP#Sph)Wh`|5|4H<YDxPWX0pbAe0U$80zAm56?
Ngux6%Zp?FH0RX@N3iJQ~

delta 10
Rcmeytxq)*+<;H{NEC3q-1aSZW

diff --git a/t/output/write_gom_ulhbomcl.ged b/t/output/write_gom_ulhbomcl.ged
index 006ddea07062ec2ab1d3906847a1eebf931392df..f6df52f90a136d5b73761ff3620e567bf0cf0c41 100644
GIT binary patch
delta 72
zcmdnQ`HOQxm8}bdBSQ#-D}w@qB@hP#Sph)Wh`|5|4H<YDxPWX0pbAe0U$80zAm56?
Ngux6%Zp?RP0RX{d3i|*6

delta 10
RcmeyxxruW^)y6{>EC3rW1b6@d

diff --git a/t/output/write_gom_ulhc.ged b/t/output/write_gom_ulhc.ged
index 61392d20fac8dbe3f0d3d2d97241af4086d4909a..156c3dc170503941a5a97c14aa16bf7dcf4ecee8 100644
GIT binary patch
delta 70
zcmbQld5v>Ifwc>RBSQ#-D}w@qB@hP#Sph)Wh`|5|4H<ZWECryvCxb6ojRBBv#bCl<
L1|m16YqJ0VosJ5D

delta 10
Rcmcb{If-*Z!Nx60EC3ij1O@;A

diff --git a/t/output/write_gom_ulhcl.ged b/t/output/write_gom_ulhcl.ged
index 38ef0c626523528d8b42e2981006055db38329c1..6a49e231989e4d41d3aa6b6b5930ae75cb442298 100644
GIT binary patch
delta 72
zcmdnM`Ga#pg{=#NBSQ#-D}w@qB@hP#Sph)Wh`|5|4H<YDxPWX0pbAe0U$80zAm56?
Ngux6%Zp?LN0RX?e3iAK}

delta 10
Rcmeytxq)*+#l`~`EC3q%1aJTV

diff --git a/t/output/write_gom_ulhl.ged b/t/output/write_gom_ulhl.ged
index dff7bb3b14f798cef323ad161992799348e777f3..4f190de68b44648c2bff21fdab7bac4379de60a9 100644
GIT binary patch
delta 70
zcmbQld5v>Ifwc>RBSQ#-D}w@qB@hP#Sph)Wh`|5|4H>wAECryvCxb6ojRBBv#bCl<
L1|m16YqJ0Vohu4{

delta 10
Rcmcb{If-*Z!Nx60EC3ij1O@;A

diff --git a/t/output/write_gom_ulhlc.ged b/t/output/write_gom_ulhlc.ged
index 100bcb14e3744ef9bf48db7f0f535d55348c09ba..06493c948e974f87dc1fdb9cf9f7c1d866428c86 100644
GIT binary patch
delta 72
zcmdnM`Ga#pg{=#NBSQ#-D}w@qB@hP#Sph)Wh`|5|4H>u?c!6vMpbAe0U$80zAm56?
Ngux6%Zp?LN0RX?Y3iAK}

delta 10
Rcmeytxq)*+#l`~`EC3q%1aJTV

diff --git a/t/src/gom_write.c b/t/src/gom_write.c
index cb28844..65aef2e 100644
--- a/t/src/gom_write.c
+++ b/t/src/gom_write.c
@@ -31,6 +31,7 @@
 #define WRITE_GEDCOM "gom_write.ged"
 #define PROG_NAME "writegomtest"
 #define PROG_VERSION "3.14"
+#define TIMESTAMP 1000000000L
 
 void gedcom_message_handler(Gedcom_msg_type type, char *msg)
 {
@@ -90,6 +91,8 @@ int update_header(char* encoding)
 int main(int argc, char* argv[])
 {
   int result;
+  struct tm* tm_ptr;
+  time_t tval;
   int total_conv_fails = 0;
   char* outfilename = NULL;
   char* infilename  = NULL;
@@ -223,6 +226,14 @@ 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 |= gom_write_file(gedfilename, &total_conv_fails);
   if (result == 0 && total_conv_fails == 0) {
-- 
2.30.2