Closed GoogleCodeExporter closed 8 years ago
I have a partial tentative patch, runtime.cc compiles, and with
-DHAVE_TM_ZONE_IN_TM
does what I'd expect:
diff -r c6ed3922588c pure/runtime.cc
--- a/pure/runtime.cc Fri Apr 23 14:01:52 2010 +0200
+++ b/pure/runtime.cc Fri Apr 23 20:00:18 2010 +0200
@@ -10929,6 +10929,16 @@
void pure_tzset(void)
{
interpreter& interp = *interpreter::g_interp;
+#ifndef HAVE_DAYLIGHT_IN_TZSET
+ int32_t timezone = 0;
+ int32_t daylight = 0;
+# ifdef HAVE_TM_ZONE_IN_TM
+ time_t t = time(NULL);
+ tm* lt = localtime(&t);
+ timezone = lt->tm_gmtoff;
+ daylight = lt->tm_isdst;
+# endif
+#endif
tzset();
df(interp, "timezone", pure_int(timezone));
df(interp, "daylight", pure_int(daylight));
If you think it's ok I'll follow up with the implied autoconf machinery.
Original comment by neuhau...@sigpipe.cz
on 23 Apr 2010 at 7:33
Roman, I think that the timezone value should actually be -lt.tm_gmtoff +
lt.tm_isdst
* 3600, as the tm_gmtoff value is positive and includes the dst offset. (At
least
it's that way on my Linux system, I don't have a *BSD system to try it there.)
This
is also what the cited post at freebsd-questions suggests.
Just for the record, here is what the Pure interpreter gives me for these
values, so
that you can check it against your results (that's CET a.k.a. central european
time,
with daylight savings in effect):
$ pure
> using system;
> timezone,daylight,tzname;
-3600,1,["CET","CEST"]
Otherwise, your patch looks good to me. Can you please post the entire patch
including the configury so that I can apply it?
Original comment by aggraef@gmail.com
on 25 Apr 2010 at 11:32
I'm in the same timezone, and see the same values with the attached patch
applied.
Original comment by neuhau...@sigpipe.cz
on 26 Apr 2010 at 8:41
Attachments:
Applied in r3399. Thanks!
Original comment by aggraef@gmail.com
on 27 Apr 2010 at 11:09
Original issue reported on code.google.com by
neuhau...@sigpipe.cz
on 23 Apr 2010 at 1:52