Search code examples
kdbq-lang

Why is the kdb+ epoch date 2000.01.01?


I am new to kdb+ and I was wondering why the epoch date of 2000.01.01 for kdb is different to that of unix (1970.01.01).

Does the difference affect any interactions with the operating system or other languages?


Solution

  • KDB+ uses a different epoch because it follows a different standard. KDB+ follows the J2000 international standard, which is based on the Julian year.

    UNIX uses POSIX time, which was initially a 32 bit unsigned integer. Because the time was calculated to 60ths of a second, the 32 bit integer would only work for about 829 days, so a recent date had to be chosen.

    The first edition Unix Programmer's Manual dated November 3, 1971 defines the Unix time as "the time since 00:00:00, Jan. 1, 1971, measured in sixtieths of a second"

    This difference can cause issues if you don't make sure to convert to one standard before piping the chosen epoch time into applications.