| OLD | NEW |
| 1 /* Portions are Copyright (C) 2011 Google Inc */ | 1 /* Portions are Copyright (C) 2011 Google Inc */ |
| 2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
| 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 4 * | 4 * |
| 5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
| 6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
| 7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
| 8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
| 9 * | 9 * |
| 10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 *------------------------------------------------------------------------ | 100 *------------------------------------------------------------------------ |
| 101 */ | 101 */ |
| 102 PRTime | 102 PRTime |
| 103 PR_ImplodeTime(const PRExplodedTime *exploded) | 103 PR_ImplodeTime(const PRExplodedTime *exploded) |
| 104 { | 104 { |
| 105 // This is important, we want to make sure multiplications are | 105 // This is important, we want to make sure multiplications are |
| 106 // done with the correct precision. | 106 // done with the correct precision. |
| 107 static const PRTime kSecondsToMicroseconds = static_cast<PRTime>(1000000); | 107 static const PRTime kSecondsToMicroseconds = static_cast<PRTime>(1000000); |
| 108 #if defined(OS_WIN) | 108 #if defined(OS_WIN) |
| 109 // Create the system struct representing our exploded time. | 109 // Create the system struct representing our exploded time. |
| 110 SYSTEMTIME st = {0}; | 110 SYSTEMTIME st = {}; |
| 111 FILETIME ft = {0}; | 111 FILETIME ft = {}; |
| 112 ULARGE_INTEGER uli = {0}; | 112 ULARGE_INTEGER uli = {}; |
| 113 | 113 |
| 114 st.wYear = exploded->tm_year; | 114 st.wYear = exploded->tm_year; |
| 115 st.wMonth = static_cast<WORD>(exploded->tm_month + 1); | 115 st.wMonth = static_cast<WORD>(exploded->tm_month + 1); |
| 116 st.wDayOfWeek = exploded->tm_wday; | 116 st.wDayOfWeek = exploded->tm_wday; |
| 117 st.wDay = static_cast<WORD>(exploded->tm_mday); | 117 st.wDay = static_cast<WORD>(exploded->tm_mday); |
| 118 st.wHour = static_cast<WORD>(exploded->tm_hour); | 118 st.wHour = static_cast<WORD>(exploded->tm_hour); |
| 119 st.wMinute = static_cast<WORD>(exploded->tm_min); | 119 st.wMinute = static_cast<WORD>(exploded->tm_min); |
| 120 st.wSecond = static_cast<WORD>(exploded->tm_sec); | 120 st.wSecond = static_cast<WORD>(exploded->tm_sec); |
| 121 st.wMilliseconds = static_cast<WORD>(exploded->tm_usec/1000); | 121 st.wMilliseconds = static_cast<WORD>(exploded->tm_usec/1000); |
| 122 // Convert to FILETIME. | 122 // Convert to FILETIME. |
| (...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 + 60 * localTime.tm_hour | 1243 + 60 * localTime.tm_hour |
| 1244 + 1440 * (localTime.tm_mday - 2); | 1244 + 1440 * (localTime.tm_mday - 2); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 result->tm_params.tp_gmt_offset = zone_offset * 60; | 1247 result->tm_params.tp_gmt_offset = zone_offset * 60; |
| 1248 result->tm_params.tp_dst_offset = dst_offset * 60; | 1248 result->tm_params.tp_dst_offset = dst_offset * 60; |
| 1249 | 1249 |
| 1250 *result_imploded = PR_ImplodeTime(result); | 1250 *result_imploded = PR_ImplodeTime(result); |
| 1251 return PR_SUCCESS; | 1251 return PR_SUCCESS; |
| 1252 } | 1252 } |
| OLD | NEW |