Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#14 closed enhancement (fixed)

Support survey dates before 1970

Reported by: Graham Owned by: Olly Betts
Priority: major Milestone: 1.1.15
Component: aven Version: 1.1.13
Keywords: date Cc:

Description

It would be useful if Survex could be made to register dates earlier than 1970. At least as far back as 1940 would be good for me.

Change History (3)

comment:1 Changed 10 years ago by Olly Betts

Milestone: 1.1.14
Status: newassigned

The simplest solution for now seems to be to make the time value in the 3d file signed and relax the < 1970 check to be < 1902. That comfortably covers the date ranges people seem to have survey data for.

That'll trivially work on platforms with a signed time_t (which seems to be all the ones we care about), but it seems Microsoft's C runtime doesn't handle negative time_t well:

http://code.google.com/p/y2038/wiki/AmazingDiscoveries

So I guess we'll need to provide our own mktime() replacement there. It's not a complex function, and I found an implementation here with a suitable licence:

http://lynx.isc.org/lynx2.8.5/lynx2-8-5/src/mktime.c

comment:2 Changed 10 years ago by Olly Betts

Resolution: fixed
Status: assignedclosed
Summary: DatesSupport survey dates before 1970

Fixed in r3519.

I bypassed all the time_t range issues by storing the date as the number of days since Jan 1st 1900, so survey dates from 1900-2078 are now accepted, and .3d files are smaller too.

comment:3 Changed 10 years ago by Olly Betts

Milestone: 1.1.141.1.15

Setting milestone to 1.1.15, since that's the release this fix will be in.

Note: See TracTickets for help on using tickets.