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