java display Windows UTC time

前端 未结 2 872
忘掉有多难
忘掉有多难 2021-01-16 22:04

Windows stores FileTime internally as the number of 100-nanoseconds since 1.1.1601 UTC as a 64bit field, is it possible to get java to print out the current number? Just loo

2条回答
  •  -上瘾入骨i
    2021-01-16 22:28

    Approximately

    long diff1601to1970 = 315532800 * 1000000000; // <-- diff in nanoseconds(1/1/1601 to 1/1/1970)
    long currentFrom1970 =  System.currentTimeMillis() * 1000000;
    long currentFrom1601 = diff1601to1970 + currentFrom1970;
    

提交回复
热议问题