NTFILETIME1601/1/1 0:00 ̎Ԍo߂100imbPʂŎ́B
~10000000ŕbƂȂB


boost::xpressivegƃTCY400kB

FILETIME totime(const std::wstring &digits) {
  SYSTEMTIME st;
  FILETIME ft, lt;
  boost::xpressive::wsmatch what;
  // CCYYMMhhmm.ss
  boost::xpressive::wsregex p1 = boost::xpressive::wsregex::compile(
   L"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
   L"\\.[0-9][0-9]");
  // CCYYMMhhmm
  boost::xpressive::wsregex p2 = boost::xpressive::wsregex::compile(
   L"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]");
  // YYMMhhmm.ss
  boost::xpressive::wsregex p3 = boost::xpressive::wsregex::compile(
   L"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
   L"\\.[0-9][0-9]");
  // YYMMhhmm
  boost::xpressive::wsregex p4 = boost::xpressive::wsregex::compile(
   L"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]");
  // MMhhmm.ss
  boost::xpressive::wsregex p5 = boost::xpressive::wsregex::compile(
   L"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
   L"\\.[0-9][0-9]");
  // MMhhmm
  boost::xpressive::wsregex p6 = boost::xpressive::wsregex::compile(
   L"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]");
  if (boost::xpressive::regex_match(digits, what, p1)) {
    st.wDayOfWeek = st.wMilliseconds = 0;
    st.wYear = _wtoi(digits.substr(0, 4).c_str());
    st.wMonth = _wtoi(digits.substr(4, 2).c_str());
    st.wDay = _wtoi(digits.substr(6, 2).c_str());
    st.wHour = _wtoi(digits.substr(8, 2).c_str());
    st.wMinute = _wtoi(digits.substr(10, 2).c_str());
    st.wSecond = _wtoi(digits.substr(13, 2).c_str());
  } else if (boost::xpressive::regex_match(digits, what, p2)) {
    st.wDayOfWeek = st.wMilliseconds = 0;
    st.wYear = _wtoi(digits.substr(0, 4).c_str());
    st.wMonth = _wtoi(digits.substr(4, 2).c_str());
    st.wDay = _wtoi(digits.substr(6, 2).c_str());
    st.wHour = _wtoi(digits.substr(8, 2).c_str());
    st.wMinute = _wtoi(digits.substr(10, 2).c_str());
    st.wSecond = 0;
  } else if (boost::xpressive::regex_match(digits, what, p3)) {
    st.wDayOfWeek = st.wMilliseconds = 0;
    st.wYear = _wtoi(digits.substr(0, 2).c_str());
    st.wYear = ((st.wYear < 70) ? st.wYear + 2000 : st.wYear + 1900);
    st.wMonth = _wtoi(digits.substr(2, 2).c_str());
    st.wDay = _wtoi(digits.substr(4, 2).c_str());
    st.wHour = _wtoi(digits.substr(6, 2).c_str());
    st.wMinute = _wtoi(digits.substr(8, 2).c_str());
    st.wSecond = _wtoi(digits.substr(11, 2).c_str());
  } else if (boost::xpressive::regex_match(digits, what, p4)) {
    st.wDayOfWeek = st.wMilliseconds = 0;
    st.wYear = _wtoi(digits.substr(0, 2).c_str());
    st.wYear = ((st.wYear < 70) ? st.wYear + 2000 : st.wYear + 1900);
    st.wMonth = _wtoi(digits.substr(2, 2).c_str());
    st.wDay = _wtoi(digits.substr(4, 2).c_str());
    st.wHour = _wtoi(digits.substr(6, 2).c_str());
    st.wMinute = _wtoi(digits.substr(8, 2).c_str());
    st.wSecond = 0;
  } else if (boost::xpressive::regex_match(digits, what, p5)) {
    st.wDayOfWeek = st.wMilliseconds = 0;
    st.wYear = ((SYSTEMTIME)winsys::ftime()).wYear;
    st.wMonth = _wtoi(digits.substr(0, 2).c_str());
    st.wDay = _wtoi(digits.substr(2, 2).c_str());
    st.wHour = _wtoi(digits.substr(4, 2).c_str());
    st.wMinute = _wtoi(digits.substr(6, 2).c_str());
    st.wSecond = _wtoi(digits.substr(8, 2).c_str());
  } else if (boost::xpressive::regex_match(digits, what, p6)) {
    st.wDayOfWeek = st.wMilliseconds = 0;
    st.wYear = ((SYSTEMTIME)winsys::ftime()).wYear;
    st.wMonth = _wtoi(digits.substr(0, 2).c_str());
    st.wDay = _wtoi(digits.substr(2, 2).c_str());
    st.wHour = _wtoi(digits.substr(4, 2).c_str());
    st.wMinute = _wtoi(digits.substr(6, 2).c_str());
    st.wSecond = 0;
  } else {
    throw winsys::win_error<wchar_t>(digits + L":tw菑G[");
  }
  ::SystemTimeToFileTime(&st, &ft);
  ::LocalFileTimeToFileTime(&ft, &lt);
  return lt;
}
