[PATCH 2/2] Use get_dive to populate divelistview with dives

Dirk Hohndel dirk at hohndel.org
Thu Apr 18 13:31:56 PDT 2013


Dirk Hohndel <dirk at hohndel.org> writes:

> amit.k.chaudhuri at gmail.com writes:
>> +				    QDateTime::fromTime_t(d->when).toString(),
>
> Oh, didn't see this until just now when I started to look into
> it... as Linus pointed out - you really don't want to do that as this
> will break for anyone who doesn't happen to live in GMT.

Ok, I just pushed two more commits to clean this up. These commits also
show why I think it's a mistake to simply toss away Subsurface's types
and pass around floats and strings.

a) floats are not needed. almost everything we do has been rather
carefully designed to fit in ints
b) the moment you convert to float you lose type checking. Had you
designed the constructor so that it takes a timestamp_t, a duration_t, a
depth_t, etc as arguments then mistakes like this one would have been
caught by the compiler - and the date string conversion would happen in
one place. 

I was briefly tempted to fix the constructor to use the types that I
want it to use but I'm way past my lunch break and need to go back to
real work. But that's something I really want to see...

/D


More information about the subsurface mailing list