| 1 | /* |
| 2 | * Copyright (C) 2004-2005 by Objective Systems, Inc. |
| 3 | * |
| 4 | * This software is furnished under an open source license and may be |
| 5 | * used and copied only in accordance with the terms of this license. |
| 6 | * The text of the license may generally be found in the root |
| 7 | * directory of this installation in the LICENSE.txt file. It |
| 8 | * can also be viewed online at the following URL: |
| 9 | * |
| 10 | * http://www.obj-sys.com/open/license.html |
| 11 | * |
| 12 | * Any redistributions of this file including modified versions must |
| 13 | * maintain this copyright notice. |
| 14 | * |
| 15 | *****************************************************************************/ |
| 16 | /** |
| 17 | * @file ooDateTime.h |
| 18 | * Time functions that reconcile differences between Windows and UNIX. |
| 19 | */ |
| 20 | #ifndef _OOTIME_H_ |
| 21 | #define _OOTIME_H_ |
| 22 | |
| 23 | #include "ooCommon.h" |
| 24 | #include <time.h> |
| 25 | |
| 26 | #ifdef __cplusplus |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
| 30 | /** |
| 31 | * This function provides an abstraction for the UNIX 'gettimeofday' |
| 32 | * function which is not available on Windows. |
| 33 | * |
| 34 | * @param tv Pointer to time value structure to receive |
| 35 | * current time value. |
| 36 | * @param tz Point to time zone information. |
| 37 | * @return Completion status of operation: 0 = success, |
| 38 | * negative return value is error. |
| 39 | */ |
| 40 | EXTERN int ooGetTimeOfDay (struct timeval *tv, struct timezone *tz); |
| 41 | |
| 42 | /** |
| 43 | * This function subtracts first timeval parameter from second and provides |
| 44 | * the difference in milliseconds. |
| 45 | * @param tv1 Pointer to timeval value. |
| 46 | * @param tv2 Pointer to timeval value. |
| 47 | * |
| 48 | * @return Difference between two timevals in milliseconds. |
| 49 | */ |
| 50 | EXTERN long ooGetTimeDiff(struct timeval *tv1, struct timeval *tv2); |
| 51 | |
| 52 | EXTERN int ooGetTimeOfDay (struct timeval *tv, struct timezone *tz); |
| 53 | EXTERN long ooGetTimeDiff(struct timeval *tv1, struct timeval *tv2); |
| 54 | |
| 55 | #ifdef __cplusplus |
| 56 | } |
| 57 | #endif |
| 58 | #endif |