From db5fefce1f9b522113b15f44642fee9e1ac2b068 Mon Sep 17 00:00:00 2001 From: "David G. Holm" Date: Tue, 25 May 1999 02:26:51 +0000 Subject: [PATCH] See ChangeLog entry 19990524-19:20 EST David G. Holm --- harbour/ChangeLog | 6 ++++++ harbour/source/rtl/dates.c | 23 +++++++++++++++++++++++ harbour/tests/working/dates.prg | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4ee6f7e4be..0f78544255 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +19990524-19:20 EST David G. Holm + * source/rtl/dates.c + - Added HARBOUR DATE() function. + * tests/working/dates.prg + - Added use of DATE() function in first OUTSTD call. + 19990524-21:05 CET Eddie Runia * source/rtl/strings.c PAD* didn't work correctly with negative numbers diff --git a/harbour/source/rtl/dates.c b/harbour/source/rtl/dates.c index 02c326d394..395b7b01a0 100644 --- a/harbour/source/rtl/dates.c +++ b/harbour/source/rtl/dates.c @@ -425,3 +425,26 @@ oTime->tm_sec); } } +HARBOUR DATE( void ) +{ + if( _pcount() == 0 ) + { + time_t t; + struct tm *oTime; + char szTime[9]; + + time(&t); + oTime = localtime(&t); + sprintf(szTime, "%04d%02d%02d", oTime->tm_year, oTime->tm_mon + 1, +oTime->tm_mday); + _retds(szTime); + } + else + { + /* QUESTION: Clipper catches this at compile time! */ + PITEM pError = _errNew(); + _errPutDescription(pError, "Incorrect number of arguments: DATE"); + _errLaunch(pError); + _errRelease(pError); + } +} diff --git a/harbour/tests/working/dates.prg b/harbour/tests/working/dates.prg index 3aa9033f5c..2239eaab75 100644 --- a/harbour/tests/working/dates.prg +++ b/harbour/tests/working/dates.prg @@ -7,7 +7,7 @@ local cNewLine := CHR( 10 ) local dDate, dDate2, cMask, cDate - OUTSTD (cNewLine, "Testing Harbour dates management", cNewLine) + OUTSTD (cNewLine, "Testing Harbour dates management on", DATE(), cNewLine) OUTSTD (cNewLine, HB_SETCENTURY ()) HB_SETCENTURY ("ON")