1 /*****************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * The contents of this file are subject to the Mozilla Public License
9 * Version 1.0 (the "License"); you may not use this file except in
10 * compliance with the License. You may obtain a copy of the License at
11 * http://www.mozilla.org/MPL/
13 * Software distributed under the License is distributed on an "AS IS"
14 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
15 * License for the specific language governing rights and limitations
18 * The Original Code is Curl.
20 * The Initial Developer of the Original Code is Daniel Stenberg.
22 * Portions created by the Initial Developer are Copyright (C) 1998.
23 * All Rights Reserved.
25 * ------------------------------------------------------------
27 * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
31 * $Source: /cvsroot/curl/curl/lib/timeval.c,v $
32 * $Revision: 1.1.1.1 $
33 * $Date: 1999-12-29 14:21:38 $
38 * ------------------------------------------------------------
39 ****************************************************************************/
46 #ifndef HAVE_GETTIMEOFDAY
50 gettimeofday (struct timeval
*tp
, void *nothing
)
55 /* mktime converts local to UTC */
57 tmtm
.tm_sec
= st
.wSecond
;
58 tmtm
.tm_min
= st
.wMinute
;
59 tmtm
.tm_hour
= st
.wHour
;
60 tmtm
.tm_mday
= st
.wDay
;
61 tmtm
.tm_mon
= st
.wMonth
- 1;
62 tmtm
.tm_year
= st
.wYear
- 1900;
66 tp
->tv_usec
= st
.wMilliseconds
* 1000;
69 #define HAVE_GETTIMEOFDAY
73 struct timeval
tvnow ()
76 #ifdef HAVE_GETTIMEOFDAY
77 gettimeofday (&now
, NULL
);
79 now
.tv_sec
= (long) time(NULL
);
85 double tvdiff (struct timeval t1
, struct timeval t2
)
87 return (double)(t1
.tv_sec
- t2
.tv_sec
) + ((t1
.tv_usec
-t2
.tv_usec
)/1000000.0);
90 long tvlong (struct timeval t1
)