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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 | 64 |
65 typedef PRIntn PRBool; | 65 typedef PRIntn PRBool; |
66 #define PR_TRUE 1 | 66 #define PR_TRUE 1 |
67 #define PR_FALSE 0 | 67 #define PR_FALSE 0 |
68 | 68 |
69 typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus; | 69 typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus; |
70 | 70 |
71 #define PR_ASSERT DCHECK | 71 #define PR_ASSERT DCHECK |
72 #define PR_CALLBACK | 72 #define PR_CALLBACK |
73 #define PR_INT16_MAX 32767 | 73 #define PR_INT16_MAX 32767 |
74 #define NSPR_API(__type) extern __type | 74 #define NSPR_API(__type) extern __type |
wtc
2016/02/20 01:05:16
Please add the new macros here.
pkl (ping after 24h if needed)
2016/02/20 07:28:49
Acknowledged.
| |
75 | 75 |
76 /**********************************************************************/ | 76 /**********************************************************************/ |
77 /************************* TYPES AND CONSTANTS ************************/ | 77 /************************* TYPES AND CONSTANTS ************************/ |
78 /**********************************************************************/ | 78 /**********************************************************************/ |
79 | 79 |
80 #define PR_MSEC_PER_SEC 1000UL | 80 #define PR_MSEC_PER_SEC 1000UL |
81 #define PR_USEC_PER_SEC 1000000UL | 81 #define PR_USEC_PER_SEC 1000000UL |
82 #define PR_NSEC_PER_SEC 1000000000UL | 82 #define PR_NSEC_PER_SEC 1000000000UL |
83 #define PR_USEC_PER_MSEC 1000UL | 83 #define PR_USEC_PER_MSEC 1000UL |
84 #define PR_NSEC_PER_MSEC 1000000UL | 84 #define PR_NSEC_PER_MSEC 1000000UL |
85 | 85 |
86 /* | 86 /* |
87 * PRTime -- | 87 * PRTime -- |
88 * | 88 * |
89 * NSPR represents basic time as 64-bit signed integers relative | 89 * NSPR represents basic time as 64-bit signed integers relative |
90 * to midnight (00:00:00), January 1, 1970 Greenwich Mean Time (GMT). | 90 * to midnight (00:00:00), January 1, 1970 Greenwich Mean Time (GMT). |
91 * (GMT is also known as Coordinated Universal Time, UTC.) | 91 * (GMT is also known as Coordinated Universal Time, UTC.) |
92 * The units of time are in microseconds. Negative times are allowed | 92 * The units of time are in microseconds. Negative times are allowed |
93 * to represent times prior to the January 1970 epoch. Such values are | 93 * to represent times prior to the January 1970 epoch. Such values are |
94 * intended to be exported to other systems or converted to human | 94 * intended to be exported to other systems or converted to human |
95 * readable form. | 95 * readable form. |
96 * | 96 * |
97 * Notes on porting: PRTime corresponds to time_t in ANSI C. NSPR 1.0 | 97 * Notes on porting: PRTime corresponds to time_t in ANSI C. NSPR 1.0 |
98 * simply uses PRInt64. | 98 * simply uses PRInt64. |
99 */ | 99 */ |
100 | 100 |
101 typedef PRInt64 PRTime; | 101 typedef PRInt64 PRTime; |
102 | 102 |
103 /* | 103 /* |
104 * Long-long (64-bit signed integer type) support macros used by | |
105 * PR_ImplodeTime(). | |
106 * See http://lxr.mozilla.org/nspr/source/pr/include/prlong.h | |
107 */ | |
108 | |
109 #define LL_I2L(l, i) ((l) = (PRInt64)(i)) | |
110 #define LL_MUL(r, a, b) ((r) = (a) * (b)) | |
111 #define LL_ADD(r, a, b) ((r) = (a) + (b)) | |
112 #define LL_SUB(r, a, b) ((r) = (a) - (b)) | |
wtc
2016/02/20 01:05:16
This is in the middle of the code copied from prti
pkl (ping after 24h if needed)
2016/02/20 07:28:49
Thank you for the review and suggestion! Code move
| |
113 | |
114 /* | |
104 * Time zone and daylight saving time corrections applied to GMT to | 115 * Time zone and daylight saving time corrections applied to GMT to |
105 * obtain the local time of some geographic location | 116 * obtain the local time of some geographic location |
106 */ | 117 */ |
107 | 118 |
108 typedef struct PRTimeParameters { | 119 typedef struct PRTimeParameters { |
109 PRInt32 tp_gmt_offset; /* the offset from GMT in seconds */ | 120 PRInt32 tp_gmt_offset; /* the offset from GMT in seconds */ |
110 PRInt32 tp_dst_offset; /* contribution of DST in seconds */ | 121 PRInt32 tp_dst_offset; /* contribution of DST in seconds */ |
111 } PRTimeParameters; | 122 } PRTimeParameters; |
112 | 123 |
113 /* | 124 /* |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 * This is the only funtion that should be called from outside base, and only | 254 * This is the only funtion that should be called from outside base, and only |
244 * from the unit test. | 255 * from the unit test. |
245 */ | 256 */ |
246 | 257 |
247 BASE_EXPORT PRStatus PR_ParseTimeString ( | 258 BASE_EXPORT PRStatus PR_ParseTimeString ( |
248 const char *string, | 259 const char *string, |
249 PRBool default_to_gmt, | 260 PRBool default_to_gmt, |
250 PRTime *result); | 261 PRTime *result); |
251 | 262 |
252 #endif // BASE_PRTIME_H__ | 263 #endif // BASE_PRTIME_H__ |
OLD | NEW |