6
$\begingroup$

Bug fixed in 10.0.0+2014080602


I noticed a strange thing when trying the new astronomical data functions in Mathematica 10 on my Raspberry Pi. The Sunrise and Sunset functions return incorrect times. Then I started to play with time and date functions and I've discovered that Date and DateList return different results. As a reference, the output of both functions on my main computer:

Column[{Date[], DateList[],$TimeZone}]
{2014,3,31,20,54,59.141095}
{2014,3,31,20,54,59.141123}
2.

But on the Raspberry Pi:

{2014,3,31,20,54,49.685639}
{2014,3,31,19,54,49.778047}
1.

Looks like the $TimeZone is off, but Date ignores it. Let's look at the documentation of the two functions:

Date[] uses whatever date and time have been set on your computer system. It performs no corrections for time zones, daylight saving time, etc.

vs

DateList[] uses whatever date and time have been set on your computer system. It performs no corrections for time zones, daylight saving time, etc.

So they should return exactly the same output. There's a warning that "Date has been superseded by DateList since Version 6.0" but in this case it actually works better. Why doesn't Mathematica detect the correct time zone and why does Date work, but DateList doesn't?

$\endgroup$
4
  • $\begingroup$ do this Read["!date","String"] then Close["!date"] I'm guessing its something to do with daylight savings time, but lets see how the sys clock is set in any case. $\endgroup$
    – george2079
    Mar 31, 2014 at 20:40
  • $\begingroup$ It gets the correct time: "Mon Mar 31 22:59:02 CEST 2014". $\endgroup$
    – shrx
    Mar 31, 2014 at 20:59
  • $\begingroup$ So it looks like its giving you the standard time. Should be reported as a bug I'd say. $\endgroup$
    – george2079
    Mar 31, 2014 at 21:12
  • $\begingroup$ I can reproduce this problem with the January 29 version. $\endgroup$
    – Szabolcs
    May 24, 2014 at 21:09

1 Answer 1

4
$\begingroup$

It appears as if this problem was a in earlier versions of the RPi distribution. The August 4, 2014 version behaves as expected.:

$Version
    Column[{Date[],DateList[],$TimeZone}]
(*
10.0 for Linux ARM (32-bit) (August 4, 2014)
{2014, 12, 17, 18, 30, 42.338928}
{2014, 12, 17, 18, 30, 42.339383}
-6.
*)
$\endgroup$
1
  • $\begingroup$ Thanks, I can confirm it works with the latest version. $\endgroup$
    – shrx
    Dec 18, 2014 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.