Time now and system time

David T. Lewis lewis at mail.msen.com
Sat Jun 7 14:47:33 UTC 2003


On Fri, Jun 06, 2003 at 10:51:53AM -0700, Derek Brans wrote:
> I'm running a recent version of Debian.
> 
> When I type "date" at the shell prompt I get this:
> Fri Jun  6 10:47:11 PDT 2003
> 
> When I evaluate "Time now" in the Squeak image I get this:
> 18:47
> 
> The shell time is correct.  I changed the timezone on my machine since the image has been alive.  Squeak seems to be showing me the time without the timezone difference, ie UCT.
> 
> How do I get Squeak to show the same time as the system time?

My guess is that you have set up your system as if it were a real
computer instead of a PC, and your BIOS clock is set to UTC rather
than local time. Squeak is dumb with respect to time zone offsets,
and it is probably giving you the value of "now" in a UTC time zone.

For the Unix VM, getting the current time works like this:

 Time class>>now
  Time class>>dateAndTimeNow
   Time class>>millisecondClockValue
    Time class>>primMillisecondClock
     <primitive: 135>
      primitiveMillisecondClock()
       ioMSecs()
         gettimeofday()

I certainly am not going to suggest that you set up your computer
incorrectly in order to make Squeak happy, but you might be able to
get by with a workaround of hacking an offset into one of the Time
class methods. I'd be interested to know if you come up with a
workable hack (I'm not going to try it on my system, which is set
up with a BIOS clock set for local time).

John McIntosh's suggestion of looking at the TZ shell environment
might also provide a workaround, if you can set it to some value
that makes Squeak happy and do it only for Squeak. That is, set
the TZ in a shell script that would run Squeak.

If you're curious about the gory details of time zones, try loading
TimeZone from Squeak Map. You can load all of the world's time zones
from your Debian system's /usr/share/zoneinfo files and find out
more than you ever wanted to know about them.

HTH,
Dave



More information about the Squeak-dev mailing list