Unix Timestamp in kdb/q

kdb, q-lang, timestamp

Solution

q)`long$.z.p
458558447196132000
q)`long$1970.01.01D00:00
-946684800000000000

So you can get nanos from 2000.01.01. From there it's a simple calculation to convert to and from a 2000.01.01-based epoch vs 1970.01.01 based epoch.

Problem

Is there a built-in way of getting the Unix timestamp in kdb/q? Something like ``` `float$.z.p ``` would be ideal; otherwise I'll have to resort to a more laborious implementation where I count the seconds from Jan 1 1970.

Original source