· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Windows Timestamp 를 Unix Timestamp 로 변환



1. 개요

  1. windows 와 unix 간의 data 통신 시에, 상호 timestamp 체계가 다른 문제를 해결하기 위한 시도
  2. Windows Time Stamp
    • 1601년 1월 1일 0시를 기준으로 현재까지의 시간을 100나노 초로 표기
    • 64bit 정수로 표현
  3. Unix Time Stamp
    • 1970년 1월 1일 0시를 기준으로 현재까지의 시간을 초로 표기
  4. 두 시간의 기준은 UTC 임

2. Windows time to unix time

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;
}


3. Unix time convert windows time

uint64_t unix2win_stamp (uint32_t stamp)
{  
  uint64_t unix_def_stamp = 116444736000000000;
  return (stamp * 10000000) + unix_def_stamp;
}

ID
Password
Join
The person you rejected yesterday could make you happy, if you say yes.


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-03-19 23:21:14
Processing time 0.0015 sec