[Scummvm-devel] ATTN: Porters. Notes about time() implementation and thumbnails

Marcus Comstedt marcus at mc.pp.se
Wed Oct 12 20:12:46 CEST 2005


Johannes Schickel <lordhoto at gmail.com> writes:

> Yeah I agree, we should fix this before 0.8.0 release.
>
>> Using localtime is probably not a good idea -- time zone
>> issues... better to use gmtime or so, and then convert it
>> for display to the local time zone (i.e. all internal times
>> should be stored in GMT/UTC, while the display should occur
>> with the local time zone).
>
> That is what Fingolfin said. As you said we could use our intern
> routine for passing it to the dialog for now with localtime, every
> other method should need to be implemented platform specific. If it is
> ok to use localtime I will do it our way.


I expect Fingolfin hadn't really thought this through when he wrote
that.   It's when you try to use GMT/UTC that you _get_ timezone
issues.

Let's assume I go for a two week trip to Japan and bring my PSP for
some portable SCUMM entertainment.  While there, I have the timezone
setting adjusted to japanese time, so as to get the correct local time
shown.  A slow evening at the hotel, I play some Maniac Mansion, and
save the game at 22:30, before going to sleep.  The savegame dialog
should of course show that the game was saved at 22:30, because it
was.

Now, after I _come home_ from Japan, having reset the timezone to
CEST, using UTC and converting at display would mean that the savegame
is suddenly presented as having taken place at 15:30.  Which is what
the time was in Sweden when I saved the game; but that's totally
irrelevant since that is not where I was.  It might just as well
display what the time had been in Zanzibar.  I saved the game in the
evening, not in the afternoon, and this is reflected by the timestamp
"22:30", not "15:30".

Even disregarding portable systems, I frankly can't come up with a
single scenario where I would like the savegame dialog to display a
_different_ timestamp when I load the game than it would have just
after saving the game.

So my take is to use local times, and anyone thinking otherwise should
motivate themselves properly.  :-)


(And no, I'm not saying UTC timestamps do not have their good points,
 just that they are moot in the context of ScummVM.)


  // Marcus






More information about the Scummvm-devel mailing list