#title Windows Timestamp 를 Unix Timestamp 로 변환 [[TableOfContents]] = 개요 = 1. windows 와 unix 간의 data 통신 시에, 상호 timestamp 체계가 다른 문제를 해결하기 위한 시도 1. Windows Time Stamp * 1601년 1월 1일 0시를 기준으로 현재까지의 시간을 100나노 초로 표기 * 64bit 정수로 표현 1. Unix Time Stamp * 1970년 1월 1일 0시를 기준으로 현재까지의 시간을 초로 표기 1. 두 시간의 기준은 UTC 임 = Windows time to unix time = {{{#!vim c uint64_t win2unix_stamp (uint64_t stamp) { /* * Start of Unix time stamp is 1970/01/01 00:00 (UTF), * and, windows time stamp of this is 116444736000000000 */ uint64_t unix_def_stamp = 11644473600; return (stamp / 10000000) - unix_def_stamp; } }}} = Unix time convert windows time = {{{#!vim c uint64_t unix2win_stamp (uint32_t stamp) { uint64_t unix_def_stamp = 116444736000000000; return (stamp * 10000000) + unix_def_stamp; } }}}