nsWindowsMigrationUtils.h (946B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef windowsmigrationutils__h__ 6 #define windowsmigrationutils__h__ 7 8 #include "prtime.h" 9 10 static PRTime WinMigrationFileTimeToPRTime(FILETIME* filetime, bool* isValid) { 11 SYSTEMTIME st; 12 *isValid = ::FileTimeToSystemTime(filetime, &st); 13 if (!*isValid) { 14 return 0; 15 } 16 PRExplodedTime prt; 17 prt.tm_year = st.wYear; 18 // SYSTEMTIME's day-of-month parameter is 1-based, 19 // PRExplodedTime's is 0-based. 20 prt.tm_month = st.wMonth - 1; 21 prt.tm_mday = st.wDay; 22 prt.tm_hour = st.wHour; 23 prt.tm_min = st.wMinute; 24 prt.tm_sec = st.wSecond; 25 prt.tm_usec = st.wMilliseconds * 1000; 26 prt.tm_wday = 0; 27 prt.tm_yday = 0; 28 prt.tm_params.tp_gmt_offset = 0; 29 prt.tm_params.tp_dst_offset = 0; 30 return PR_ImplodeTime(&prt); 31 } 32 33 #endif