diff options
| author | Richard M. Stallman | 1995-09-10 04:37:21 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-09-10 04:37:21 +0000 |
| commit | 143cb9a97724176739fc4498afe6110ad8bfd165 (patch) | |
| tree | 23dfbcb07aec91371178f4574458bf1937960cac /src | |
| parent | 7fd817093fbbd746129e4d4db00779e64347d6ef (diff) | |
| download | emacs-143cb9a97724176739fc4498afe6110ad8bfd165.tar.gz emacs-143cb9a97724176739fc4498afe6110ad8bfd165.zip | |
(Fset_time_zone_rule): New function.
(syms_of_editfns): defsubr it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/editfns.c b/src/editfns.c index 42fb68a10bd..778646be5a1 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -899,6 +899,55 @@ the data it can't find.") | |||
| 899 | return Fmake_list (2, Qnil); | 899 | return Fmake_list (2, Qnil); |
| 900 | } | 900 | } |
| 901 | 901 | ||
| 902 | DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0, | ||
| 903 | "Set the local time zone using TZ, a string specifying a time zone rule.\n\ | ||
| 904 | If TZ is nil, use implementation-defined default time zone information.") | ||
| 905 | (tz) | ||
| 906 | Lisp_Object tz; | ||
| 907 | { | ||
| 908 | extern char **environ; | ||
| 909 | static char **environbuf; | ||
| 910 | int envptrs; | ||
| 911 | char **from, **to, **newenv; | ||
| 912 | char *tzstring; | ||
| 913 | |||
| 914 | if (NILP (tz)) | ||
| 915 | tzstring = 0; | ||
| 916 | else | ||
| 917 | { | ||
| 918 | CHECK_STRING (tz, 0); | ||
| 919 | tzstring = XSTRING (tz)->data; | ||
| 920 | } | ||
| 921 | |||
| 922 | for (from = environ; *from; from++) | ||
| 923 | continue; | ||
| 924 | envptrs = from - environ + 2; | ||
| 925 | newenv = to = (char **) xmalloc (envptrs * sizeof (char *) | ||
| 926 | + (tzstring ? strlen (tzstring) + 4 : 0)); | ||
| 927 | if (tzstring) | ||
| 928 | { | ||
| 929 | char *t = (char *) (to + envptrs); | ||
| 930 | strcpy (t, "TZ="); | ||
| 931 | strcat (t, tzstring); | ||
| 932 | *to++ = t; | ||
| 933 | } | ||
| 934 | |||
| 935 | for (from = environ; *from; from++) | ||
| 936 | if (strncmp (*from, "TZ=", 3) != 0) | ||
| 937 | *to++ = *from; | ||
| 938 | *to = 0; | ||
| 939 | |||
| 940 | environ = newenv; | ||
| 941 | if (environbuf) | ||
| 942 | free (environbuf); | ||
| 943 | environbuf = newenv; | ||
| 944 | |||
| 945 | #ifdef LOCALTIME_CACHE | ||
| 946 | tzset (); | ||
| 947 | #endif | ||
| 948 | |||
| 949 | return Qnil; | ||
| 950 | } | ||
| 902 | 951 | ||
| 903 | void | 952 | void |
| 904 | insert1 (arg) | 953 | insert1 (arg) |
| @@ -2319,6 +2368,7 @@ syms_of_editfns () | |||
| 2319 | defsubr (&Sencode_time); | 2368 | defsubr (&Sencode_time); |
| 2320 | defsubr (&Scurrent_time_string); | 2369 | defsubr (&Scurrent_time_string); |
| 2321 | defsubr (&Scurrent_time_zone); | 2370 | defsubr (&Scurrent_time_zone); |
| 2371 | defsubr (&Sset_time_zone_rule); | ||
| 2322 | defsubr (&Ssystem_name); | 2372 | defsubr (&Ssystem_name); |
| 2323 | defsubr (&Smessage); | 2373 | defsubr (&Smessage); |
| 2324 | defsubr (&Smessage_box); | 2374 | defsubr (&Smessage_box); |