merge the formfield patch from ooo-build
[ooovba.git] / sal / inc / osl / time.h
blob9bea431a7ad0986898a5e9c5148f1f00c3c032da
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: time.h,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _OSL_TIME_H_
32 #define _OSL_TIME_H_
34 #include <sal/types.h>
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
40 /****************************************************************************/
41 /* TimeValue */
42 /****************************************************************************/
44 #ifdef SAL_W32
45 # pragma pack(push, 8)
46 #elif defined(SAL_OS2)
47 # pragma pack(push, 4)
48 #endif
50 /* Time since Jan-01-1970 */
52 typedef struct {
53 sal_uInt32 Seconds;
54 sal_uInt32 Nanosec;
55 } TimeValue;
57 #if defined( SAL_W32) || defined(SAL_OS2)
58 # pragma pack(pop)
59 #endif
62 /****************************************************************************/
63 /* oslDateTime */
64 /****************************************************************************/
66 typedef struct _oslDateTime
68 /*----------------------------------------------------------------------*/
69 /** contains the nanoseconds .
71 sal_uInt32 NanoSeconds;
73 /** contains the seconds (0-59).
75 sal_uInt16 Seconds;
77 /*----------------------------------------------------------------------*/
78 /** contains the minutes (0-59).
80 sal_uInt16 Minutes;
82 /*----------------------------------------------------------------------*/
83 /** contains the hour (0-23).
85 sal_uInt16 Hours;
87 /*----------------------------------------------------------------------*/
88 /** is the day of month (1-31).
90 sal_uInt16 Day;
92 /*----------------------------------------------------------------------*/
93 /** is the day of week (0-6 , 0 : Sunday).
95 sal_uInt16 DayOfWeek;
97 /*----------------------------------------------------------------------*/
98 /** is the month of year (1-12).
100 sal_uInt16 Month;
102 /*----------------------------------------------------------------------*/
103 /** is the year.
105 sal_uInt16 Year;
107 } oslDateTime;
110 /** Get the current system time as TimeValue.
111 @return false if any error occurs.
113 sal_Bool SAL_CALL osl_getSystemTime( TimeValue* pTimeVal );
116 /** Get the GMT from a TimeValue and fill a struct oslDateTime
117 @param pTimeVal[in] TimeValue
118 @param pDateTime[out] On success it receives a struct oslDateTime
120 @return sal_False if any error occurs else sal_True.
122 sal_Bool SAL_CALL osl_getDateTimeFromTimeValue( TimeValue* pTimeVal, oslDateTime* pDateTime );
125 /** Get the GMT from a oslDateTime and fill a TimeValue
126 @param pDateTime[in] oslDateTime
127 @param pTimeVal[out] On success it receives a TimeValue
129 @return sal_False if any error occurs else sal_True.
131 sal_Bool SAL_CALL osl_getTimeValueFromDateTime( oslDateTime* pDateTime, TimeValue* pTimeVal );
134 /** Convert GMT to local time
135 @param pSystemTimeVal[in] system time to convert
136 @param pLocalTimeVal[out] On success it receives the local time
138 @return sal_False if any error occurs else sal_True.
140 sal_Bool SAL_CALL osl_getLocalTimeFromSystemTime( TimeValue* pSystemTimeVal, TimeValue* pLocalTimeVal );
143 /** Convert local time to GMT
144 @param pLocalTimeVal[in] local time to convert
145 @param pSystemTimeVal[out] On success it receives the system time
147 @return sal_False if any error occurs else sal_True.
149 sal_Bool SAL_CALL osl_getSystemTimeFromLocalTime( TimeValue* pLocalTimeVal, TimeValue* pSystemTimeVal );
152 /** Get the value of the global timer
153 @return current timer value in milli seconds
156 sal_uInt32 SAL_CALL osl_getGlobalTimer(void);
158 #ifdef __cplusplus
160 #endif
162 #endif /* _OSL_TIME_H_ */