timestamp_t as string or similar

Linus Torvalds torvalds at linux-foundation.org
Wed Apr 17 07:17:30 PDT 2013


On Tue, Apr 16, 2013 at 11:50 PM, Alberto Mardegan
<mardy at users.sourceforge.net> wrote:
>
> What is timestamp_t? Looking at the code, it seems to be the seconds since
> the epoch, that is the same as time_t; but I guess there must be some reason
> why you didn't use time_t?

It is indeed "seconds since epoch", but with two extra implications:

 - it's the subsurface kind of "time without timezones". Everything is
done in localtime (since practally many dive computers don't time
zones), so it's really "seconds since epoch in UTC that makes the time
appear the same as localtime"

 - it's always 64-bit. A 32-bit time_t is fundamentally broken these
days, but it still exists.

So no, you cannot use QDateTime::fromTime_t(time).toString() because
of the time zone issues.

                    Linus


More information about the subsurface mailing list