Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _OSL_TIME_H_
30 : : #define _OSL_TIME_H_
31 : :
32 : : #include <sal/types.h>
33 : :
34 : : #ifdef __cplusplus
35 : : extern "C" {
36 : : #endif
37 : :
38 : : /****************************************************************************/
39 : : /* TimeValue */
40 : : /****************************************************************************/
41 : :
42 : : #ifdef SAL_W32
43 : : # pragma pack(push, 8)
44 : : #endif
45 : :
46 : : /* Time since Jan-01-1970 */
47 : :
48 : : typedef struct {
49 : : sal_uInt32 Seconds;
50 : : sal_uInt32 Nanosec;
51 : 53657 : } TimeValue;
52 : :
53 : : #if defined(SAL_W32)
54 : : # pragma pack(pop)
55 : : #endif
56 : :
57 : :
58 : : /****************************************************************************/
59 : : /* oslDateTime */
60 : : /****************************************************************************/
61 : :
62 : : typedef struct _oslDateTime
63 : : {
64 : : /*----------------------------------------------------------------------*/
65 : : /** contains the nanoseconds .
66 : : */
67 : : sal_uInt32 NanoSeconds;
68 : :
69 : : /** contains the seconds (0-59).
70 : : */
71 : : sal_uInt16 Seconds;
72 : :
73 : : /*----------------------------------------------------------------------*/
74 : : /** contains the minutes (0-59).
75 : : */
76 : : sal_uInt16 Minutes;
77 : :
78 : : /*----------------------------------------------------------------------*/
79 : : /** contains the hour (0-23).
80 : : */
81 : : sal_uInt16 Hours;
82 : :
83 : : /*----------------------------------------------------------------------*/
84 : : /** is the day of month (1-31).
85 : : */
86 : : sal_uInt16 Day;
87 : :
88 : : /*----------------------------------------------------------------------*/
89 : : /** is the day of week (0-6 , 0 : Sunday).
90 : : */
91 : : sal_uInt16 DayOfWeek;
92 : :
93 : : /*----------------------------------------------------------------------*/
94 : : /** is the month of year (1-12).
95 : : */
96 : : sal_uInt16 Month;
97 : :
98 : : /*----------------------------------------------------------------------*/
99 : : /** is the year.
100 : : */
101 : : sal_uInt16 Year;
102 : :
103 : : } oslDateTime;
104 : :
105 : :
106 : : /** Get the current system time as TimeValue.
107 : : @return false if any error occurs.
108 : : */
109 : : SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getSystemTime(
110 : : TimeValue* pTimeVal );
111 : :
112 : :
113 : : /** Get the GMT from a TimeValue and fill a struct oslDateTime
114 : : @param[in] pTimeVal TimeValue
115 : : @param[out] pDateTime On success it receives a struct oslDateTime
116 : :
117 : : @return sal_False if any error occurs else sal_True.
118 : : */
119 : : SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getDateTimeFromTimeValue(
120 : : TimeValue* pTimeVal, oslDateTime* pDateTime );
121 : :
122 : :
123 : : /** Get the GMT from a oslDateTime and fill a TimeValue
124 : : @param[in] pDateTime oslDateTime
125 : : @param[out] pTimeVal On success it receives a TimeValue
126 : :
127 : : @return sal_False if any error occurs else sal_True.
128 : : */
129 : : SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getTimeValueFromDateTime(
130 : : oslDateTime* pDateTime, TimeValue* pTimeVal );
131 : :
132 : :
133 : : /** Convert GMT to local time
134 : : @param[in] pSystemTimeVal system time to convert
135 : : @param[out] pLocalTimeVal On success it receives the local time
136 : :
137 : : @return sal_False if any error occurs else sal_True.
138 : : */
139 : : SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getLocalTimeFromSystemTime(
140 : : TimeValue* pSystemTimeVal, TimeValue* pLocalTimeVal );
141 : :
142 : :
143 : : /** Convert local time to GMT
144 : : @param[in] pLocalTimeVal local time to convert
145 : : @param[out] pSystemTimeVal On success it receives the system time
146 : :
147 : : @return sal_False if any error occurs else sal_True.
148 : : */
149 : : SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getSystemTimeFromLocalTime(
150 : : TimeValue* pLocalTimeVal, TimeValue* pSystemTimeVal );
151 : :
152 : :
153 : : /** Get the value of the global timer
154 : : @return current timer value in milli seconds
155 : : */
156 : :
157 : : SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getGlobalTimer(void);
158 : :
159 : : #ifdef __cplusplus
160 : : }
161 : : #endif
162 : :
163 : : #endif /* _OSL_TIME_H_ */
164 : :
165 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|