Question

I am in the process of optimizing some UniVerse data access code we have which uses UniObjects. After some experimentation, it seems that using a UniSession.OConv call to parse certain things such as decimal numbers (most we have a MR4 or MR2 or MR2$) and dates (almost all are D2/) is extremely slow (I think it might make a call back to the server to parse it).

I have already built a parser for the MR*[$] codes, but I was wondering about the dates as they are stored so I can build one for D2/. Usually they seem to be stored as a 5 digit number. I thought it could be number of days since the Unix Epoch since our UniVerse server runs on HP-UX, but after finding '15766' as a last modified date and multiplying it by 86400 (seconds per day), I got March 02, 2013 which doesn't make sense as a last modified date since as far as I know that is still in the future.

Does anyone know what the time base of these date numbers are?

Was it helpful?

Solution

It is stored as a number of days. Just do a conversion on 0 and you will get the start date.

Edit:

As noted by Los, the Epoch used in UniVerse (and UniData) is 31st Dec 1967.

OTHER TIPS

In Universe and any other Pick database, Dates and Times are stored as separate values.

The internal date is the number of days before of after 31/12/1967, which is day zero.

The internal time is the number of seconds after midnight. It can be stored as a decimal but is not normally.

In TCL there is a CDT command (stands for Convert Date) that converts dates from human readable to numeric and and vice versa:

CDT 9/28/2017 
 * Result: 18169  

CDT 18169     
 * Result: 09/28/2017     
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top