aboutsummaryrefslogtreecommitdiffstats
path: root/src/emacs.c
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1996-01-17 18:03:03 +0000
committerRichard M. Stallman <[email protected]>1996-01-17 18:03:03 +0000
commit0269dedb5c9a11f27214f60dddf3cf99031615b4 (patch)
tree3688231e8a650e53d4568267d5481c9fb38311a9 /src/emacs.c
parenta92ae0ce7b3a9d01246e1c06ecabb680bdd5fa54 (diff)
(Fdump_emacs): If HAVE_TZSET and not
LOCALTIME_CACHE, call tzset to force a tz reload. (set_time_zone_rule): New decl. (dump_tz): New var. (main): Change TZ twice if the execution TZ happens to be the same as the dump TZ. (Fdump_emacs): Set TZ to unlikely value just before dumping.
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c
index b18e3d5dc5..90c66cd6cb 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -48,6 +48,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#endif
extern void malloc_warning ();
+extern void set_time_zone_rule ();
extern char *index ();
extern char *strerror ();
@@ -315,6 +316,12 @@ extern noshare char **environ;
#endif /* LINK_CRTL_SHARE */
#endif /* VMS */
+#ifdef HAVE_TZSET
+/* A valid but unlikely value for the TZ environment value.
+ It is OK (though a bit slower) if the user actually chooses this value. */
+static char dump_tz[] = "UtC0";
+#endif
+
#ifndef ORDINARY_LINK
/* We don't include crtbegin.o and crtend.o in the link,
so these functions and variables might be missed.
@@ -940,6 +947,23 @@ Usage: %s [-t term] [--terminal term] [-nw] [--no-windows] [--batch]\n\
XSETFASTINT (Vmessage_log_max, 0);
message_dolog ("", 0, 1);
Vmessage_log_max = old_log_max;
+
+#ifdef HAVE_TZSET
+ {
+ /* If the execution TZ happens to be the same as the dump TZ,
+ change it to some other value and then change it back,
+ to force the underlying implementation to reload the TZ info.
+ This is needed on implementations that load TZ info from files,
+ since the TZ file contents may differ between dump and execution. */
+ char *tz = getenv ("TZ");
+ if (tz && !strcmp (tz, dump_tz))
+ {
+ ++*tz;
+ tzset ();
+ --*tz;
+ }
+ }
+#endif
}
initialized = 1;
@@ -1329,6 +1353,14 @@ and announce itself normally when it is run.")
tem = Vpurify_flag;
Vpurify_flag = Qnil;
+#ifdef HAVE_TZSET
+ set_time_zone_rule (dump_tz);
+#ifndef LOCALTIME_CACHE
+ /* Force a tz reload, since set_time_zone_rule doesn't. */
+ tzset ();
+#endif
+#endif
+
fflush (stdout);
#ifdef VMS
mapout_data (XSTRING (filename)->data);