Ok, I went ahead and did the full blown solution. I have not tested this at all, so there are, without doubt some bugs, but the general logic should be in the right direction.

First of all, there is an object in QF 2.6 (I don't think it was ever in 2.5) called DateTimeFunctions -- this provides a rich set of methods for manipulating and displaying dates and times -- but they are all based on seconds since Jan 1, 2000. So your problem decomposes into how to convert your 64 bit time (ms since 1970) into seconds since 2000. After that you can use the DateTimeFunctions object. (Specifically the ConvertToRTCTime method will be of interest).

The following block of code should convert your time into seconds since 2000 (as well as return the number of ms seperately)

**Code:**

func MSTimeToSecAndMS(timeStr[] as byte, secsSince2000 as reference to integer, ms as reference to integer)

'This assumes that timeStr is a 64 bit integer, that is stored in big endian format.

'timeStr[] represents the number of milliseconds elapsed since Jan 1, 1970

dim tmp1 as unibyte

dim tmp2 as integer

dim u[4] as integer

dim i as integer

'Change this loop if the value is little endian

for i = 0 to 3

FromBytes(tmp1, mid(timeStr, 2*i, 2), true)

u[i] = tmp1

next

'u now contans the 64 bit value broken into 16 bit chunks, that we can perform long division on

tmp2 := 0

for i = 0 to 3

u[i] = u[i] + tmp2 * 0x10000

tmp2 = u[i] mod 1000

u[i] = u[i] / 1000

next

'tmp2 now contains the number of milliseconds. u now contains the 64 bit value, broken into

'16 bit chunks and divided by 1000. In 2038 we could have an overflow problem.

ms = tmp2

'Next, lets get the seconds back to an integer

'The first two 16 bit chunks of u[i] should now be 0 (assuming it is before 2038, possibly before 2106)

'depending on how the signs fall out

if (u[0] <> 0) or (u[1] <> 0) then

throw ("MSTimeToSeconds", "Invalid source time!")

endif

tmp2 = 0x10000 * u[2] + u[3]

'tmp2 is now the seconds elapsed since 1970. Convert that to seconds since 2000

tmp2 := tmp2 - 946684800

secsSince2000 = tmp2

endfunc