From f12479d03a6803f2ac9de2021b58b7fc9d4e634c Mon Sep 17 00:00:00 2001 From: "David G. Holm" Date: Thu, 6 Dec 2001 01:03:13 +0000 Subject: [PATCH] See ChangeLog entry 2001-12-05 20:00 UTC-0500 David G. Holm --- harbour/ChangeLog | 5 +++++ harbour/source/rtl/seconds.c | 24 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 10d8f96889..79e3b0cb83 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,8 @@ +2001-12-05 20:00 UTC-0500 David G. Holm + + * source/rtl/seconds.c + ! Bug fix for FreeBSD 4.4 port. + 2001-12-05 16:00 UTC-0500 David G. Holm * doc/gmake.txt diff --git a/harbour/source/rtl/seconds.c b/harbour/source/rtl/seconds.c index b03ca6573a..8d533779af 100644 --- a/harbour/source/rtl/seconds.c +++ b/harbour/source/rtl/seconds.c @@ -68,27 +68,33 @@ double hb_dateSeconds( void ) #define ftime _ftime #endif #if defined(HB_OS_BSD) - struct timeval oTime; - struct timezone oZone; + struct timeval tv; + struct timezone tz; #else struct timeb tb; - struct tm * oTime; #endif + time_t seconds; + time_t fraction; + struct tm * oTime; HB_TRACE(HB_TR_DEBUG, ("hb_dateSeconds()")); #if defined(HB_OS_BSD) - gettimeofday( &oTime, &oZone ); - return ( ( double ) oTime.tv_sec + ( double ) oTime.tv_usec / 1000.0 ); + gettimeofday( &tv, &tz ); + seconds = tv.tv_sec; + fraction = tv.tv_usec; #else ftime( &tb ); - oTime = localtime( &tb.time ); + seconds = tb.time; + fraction = tb.millitm; +#endif + + oTime = localtime( &seconds ); return ( oTime->tm_hour * 3600 ) + ( oTime->tm_min * 60 ) + oTime->tm_sec + - ( ( double ) tb.millitm / 1000 ); -#endif + ( ( double ) fraction / 1000 ); } HB_FUNC( SECONDS ) @@ -107,3 +113,5 @@ HB_FUNC( HB_CLOCKS2SECS ) + +