See ChangeLog entry 19990607-19:45 EDT David G. Holm <dholm@jsd-llc.com>
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
19990607-19:45 EDT David G. Holm <dholm@jsd-llc.com>
|
||||
* include/extend.h
|
||||
- Moved "#include <limits.h>" to include/types.h
|
||||
* include/types.h
|
||||
- Moved "#include <limits.h>" from include/extend.h in order to
|
||||
avoid having to require that extend.h be included before set.h
|
||||
* source/rtl/dates.c
|
||||
- HARBOUR SECONDS() and support module hb_seconds() courtesy of
|
||||
Jose Lalin <dezac@corevia.com>. I removed the use of clock()
|
||||
from hb_time(), because clock() returns the number of clock
|
||||
ticks since the program started, which has no relationship to
|
||||
when the seconds of the real time clock roll over. This means
|
||||
that SECONDS() will always return whole seconds instead of
|
||||
seconds and hundredths. I also provided an alternate hb_seconds
|
||||
implementation for DOS platforms using gettime() instead of
|
||||
time() and localtime(), because gettime() includes 1/100ths.
|
||||
* source/rtl/files.c
|
||||
- Don't "#include <mingw32/share.h>" if compiling with DJGPP.
|
||||
+ tests/working/seconds.prg
|
||||
- New test program for SECONDS().
|
||||
|
||||
19990607-20:30 CET Eddie Runia
|
||||
* makefile.b32
|
||||
change little bug (hb.c)
|
||||
|
||||
@@ -5,16 +5,15 @@
|
||||
#ifndef _EXTEND_H
|
||||
#define _EXTEND_H
|
||||
|
||||
#define FILE _FILE /* to avoid conflicts with Harbour File() */
|
||||
//#define FILE _FILE /* to avoid conflicts with Harbour File() */
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <types.h>
|
||||
|
||||
#undef FILE
|
||||
//#undef FILE
|
||||
|
||||
typedef struct /* symbol support structure */
|
||||
{
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#ifndef _TYPES_H
|
||||
#define _TYPES_H
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef __IBMCPP__
|
||||
#define INCL_TYPES
|
||||
#include <os2.h>
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#include <set.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__DJGPP__)
|
||||
#include <dos.h>
|
||||
#endif
|
||||
|
||||
#ifndef _STRICT_CLIPPER_COMPATIBILITY
|
||||
#define _OPTIMIZE_DTOS
|
||||
@@ -22,6 +25,23 @@ extern STACK stack;
|
||||
extern char *hb_monthsname[];
|
||||
extern char *hb_daysname[];
|
||||
|
||||
double hb_seconds( void )
|
||||
{
|
||||
#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__DJGPP__)
|
||||
struct time t;
|
||||
gettime( &t );
|
||||
return( ( ( t.ti_hour * 3600 ) + ( t.ti_min * 60 ) + t.ti_sec ) + t.ti_hund / 100.0 );
|
||||
#else
|
||||
time_t t;
|
||||
struct tm *oTime;
|
||||
|
||||
time(&t);
|
||||
oTime = localtime(&t);
|
||||
|
||||
return( ( oTime->tm_hour * 3600 ) + ( oTime->tm_min * 60 ) + oTime->tm_sec );
|
||||
#endif
|
||||
}
|
||||
|
||||
char *hb_cmonth( int month )
|
||||
{
|
||||
if( month >= 1 && month <= 12 )
|
||||
@@ -566,3 +586,17 @@ HARBOUR CDOW( void )
|
||||
_errRelease(pError);
|
||||
}
|
||||
}
|
||||
|
||||
HARBOUR SECONDS( void )
|
||||
{
|
||||
if( _pcount() == 0 )
|
||||
_retnd( hb_seconds() );
|
||||
else
|
||||
{
|
||||
/* QUESTION: Clipper catches this at compile time! */
|
||||
PHB_ITEM pError = _errNew();
|
||||
_errPutDescription(pError, "Incorrect number of arguments: SECONDS");
|
||||
_errLaunch(pError);
|
||||
_errRelease(pError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <extend.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(__GNUC__) && !defined(__DJGPP__)
|
||||
#include <mingw32/share.h>
|
||||
#endif
|
||||
|
||||
|
||||
12
harbour/tests/working/seconds.prg
Normal file
12
harbour/tests/working/seconds.prg
Normal file
@@ -0,0 +1,12 @@
|
||||
/* Test SECONDS() */
|
||||
|
||||
function Main()
|
||||
local n
|
||||
|
||||
QOUT(SECONDS())
|
||||
FOR n := 1 TO 10
|
||||
__ACCEPT("Pause: ")
|
||||
QOUT(SECONDS())
|
||||
NEXT
|
||||
|
||||
return NIL
|
||||
Reference in New Issue
Block a user