| 1 |
module dwt.internal.mozilla.prtime; |
|---|
| 2 |
|
|---|
| 3 |
/* ***** BEGIN LICENSE BLOCK ***** |
|---|
| 4 |
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
|---|
| 5 |
* |
|---|
| 6 |
* The contents of this file are subject to the Mozilla Public License Version |
|---|
| 7 |
* 1.1 (the "License"); you may not use this file except in compliance with |
|---|
| 8 |
* the License. You may obtain a copy of the License at |
|---|
| 9 |
* http://www.mozilla.org/MPL/ |
|---|
| 10 |
* |
|---|
| 11 |
* Software distributed under the License is distributed on an "AS IS" basis, |
|---|
| 12 |
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|---|
| 13 |
* for the specific language governing rights and limitations under the |
|---|
| 14 |
* License. |
|---|
| 15 |
* |
|---|
| 16 |
* The Original Code is the Netscape Portable Runtime (NSPR). |
|---|
| 17 |
* |
|---|
| 18 |
* The Initial Developer of the Original Code is |
|---|
| 19 |
* Netscape Communications Corporation. |
|---|
| 20 |
* Portions created by the Initial Developer are Copyright (C) 1998-2000 |
|---|
| 21 |
* the Initial Developer. All Rights Reserved. |
|---|
| 22 |
* |
|---|
| 23 |
* Contributor(s): |
|---|
| 24 |
* |
|---|
| 25 |
* Alternatively, the contents of this file may be used under the terms of |
|---|
| 26 |
* either the GNU General Public License Version 2 or later (the "GPL"), or |
|---|
| 27 |
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|---|
| 28 |
* in which case the provisions of the GPL or the LGPL are applicable instead |
|---|
| 29 |
* of those above. If you wish to allow use of your version of this file only |
|---|
| 30 |
* under the terms of either the GPL or the LGPL, and not to allow others to |
|---|
| 31 |
* use your version of this file under the terms of the MPL, indicate your |
|---|
| 32 |
* decision by deleting the provisions above and replace them with the notice |
|---|
| 33 |
* and other provisions required by the GPL or the LGPL. If you do not delete |
|---|
| 34 |
* the provisions above, a recipient may use your version of this file under |
|---|
| 35 |
* the terms of any one of the MPL, the GPL or the LGPL. |
|---|
| 36 |
* |
|---|
| 37 |
* ***** END LICENSE BLOCK ***** */ |
|---|
| 38 |
|
|---|
| 39 |
import dwt.internal.mozilla.Common; |
|---|
| 40 |
|
|---|
| 41 |
const PR_MSEC_PER_SEC = 1000U; |
|---|
| 42 |
const PR_USEC_PER_SEC = 1000000U; |
|---|
| 43 |
const PR_NSEC_PER_SEC = 1000000000U; |
|---|
| 44 |
const PR_USEC_PER_MSEC = 1000U; |
|---|
| 45 |
const PR_NSEC_PER_MSEC = 1000000U; |
|---|
| 46 |
|
|---|
| 47 |
extern (System): |
|---|
| 48 |
|
|---|
| 49 |
alias PRInt64 PRTime; |
|---|
| 50 |
|
|---|
| 51 |
struct PRTimeParameters |
|---|
| 52 |
{ |
|---|
| 53 |
PRInt32 tp_gmt_offset; |
|---|
| 54 |
PRInt32 tp_dst_offset; |
|---|
| 55 |
} |
|---|
| 56 |
|
|---|
| 57 |
struct PRExplodedTime |
|---|
| 58 |
{ |
|---|
| 59 |
PRInt32 tm_usec; |
|---|
| 60 |
PRInt32 tm_sec; |
|---|
| 61 |
PRInt32 tm_min; |
|---|
| 62 |
PRInt32 tm_hour; |
|---|
| 63 |
PRInt32 tm_mday; |
|---|
| 64 |
PRInt32 tm_month; |
|---|
| 65 |
PRInt16 tm_year; |
|---|
| 66 |
PRInt8 tm_wday; |
|---|
| 67 |
PRInt16 tm_yday; |
|---|
| 68 |
PRTimeParameters tm_params; |
|---|
| 69 |
} |
|---|
| 70 |
|
|---|
| 71 |
alias PRTimeParameters function(PRExplodedTime *gmt)PRTimeParamFn; |
|---|
| 72 |
|
|---|
| 73 |
version(NON_XPCOM_GLUE) |
|---|
| 74 |
{ |
|---|
| 75 |
PRTime PR_Now(); |
|---|
| 76 |
void PR_ExplodeTime(PRTime usecs, PRTimeParamFn params, PRExplodedTime *exploded); |
|---|
| 77 |
PRTime PR_ImplodeTime(PRExplodedTime *exploded); |
|---|
| 78 |
void PR_NormalizeTime(PRExplodedTime *exploded, PRTimeParamFn params); |
|---|
| 79 |
|
|---|
| 80 |
PRTimeParameters PR_LocalTimeParameters(PRExplodedTime *gmt); |
|---|
| 81 |
PRTimeParameters PR_GMTParameters(PRExplodedTime *gmt); |
|---|
| 82 |
PRTimeParameters PR_USPacificTimeParameters(PRExplodedTime *gmt); |
|---|
| 83 |
|
|---|
| 84 |
PRStatus PR_ParseTimeString(char *string, PRBool default_to_gmt, PRTime *result); |
|---|
| 85 |
PRUint32 PR_FormatTime(char *buf, int buflen, char *fmt, PRExplodedTime *tm); |
|---|
| 86 |
PRUint32 PR_FormatTimeUSEnglish(char *buf, PRUint32 bufSize, char *format, PRExplodedTime *tm); |
|---|
| 87 |
} |
|---|