Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  george2079 Mar 31 at 20:40
    
It gets the correct time: "Mon Mar 31 22:59:02 CEST 2014". –  shrx Mar 31 at 20:59
    
So it looks like its giving you the standard time. Should be reported as a bug I'd say. –  george2079 Mar 31 at 21:12
    
I can reproduce this problem with the January 29 version. –  Szabolcs May 24 at 21:09

1 Answer 1

up vote 3 down vote accepted

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.
*)
share|improve this answer
    
Thanks, I can confirm it works with the latest version. –  shrx 13 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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