5

I'd like to configure some of my notebooks to assume all calculations using dates, times and locations (notably AstronomicalData , but others too) take place at the Greenwich Observatory.

I know I can achieve this by unprotecting $TimeZone and setting it to 0, as with

    $GeoLocation = {51.476786, 0.00000000};
    Unprotect[$TimeZone];
    $TimeZone = 0;
    Protect[$TimeZone];

but worry that this might have some other consequences that would confuse date and time functions.

Is it safe to do this? Does changing the value of $TimeZone have side effects I should avoid?

orome
  • 12,819
  • 3
  • 52
  • 100
  • Can't you put it in a Block? In any case, I don't see any side effects, other than some date conversions and W|A calls getting messed up. – rm -rf Dec 04 '12 at 22:35
  • @rm-rf: Block, if you mean Block[{$TimeZone=0}, ...], wasn't working for me for some functions, at least not DateList]. Also, I'd prefer to make the change global, rather than have to remember to make the change each time I do something that depends on it. – orome Dec 04 '12 at 22:39
  • Why not use TimeZone? That's what is seems to be for. E.g. Table[DateString[TimeZone -> i], {i, 0, 6}] from the documentation. – DavidC Dec 04 '12 at 22:43
  • @DavidCarraher: All calculations, globally. Forgetting to do that just once could really mess things up, and that's what I'm trying to avoid. – orome Dec 04 '12 at 22:46
  • 1
    @rm-rf: Hmmm... Block may not work, simply because DateList looks broken. Try $TimeZone=0 and then DateList[...,TimeZone->0]. That should leave the date given unchanged, but (if you're machine timezone isn't 0) it won't. I may not even be able to do what I want with a global change of $TimeZone. – orome Dec 04 '12 at 22:59
  • @rm-rf: It may not be possible to do what I'm trying to do here. The date and time related functions may not work quite the way they are described in the documentation. – orome Dec 04 '12 at 23:19

1 Answers1

4

As the Locale & Internalization guide page says $TimeZone is resettable.

Mathematica graphics

If the developers would foresee adverse effects I guess they wouldn't have documented it in this way. The only problem that I can see is that you have to take care that your system time is also set to GMT, otherwise real-time calculations (e.g., elevation of the sun as seen in Greenwich at the time of evaluation) will give the incorrect result.

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323