From a1790f54ab3b71fe65a66c69cf56212b1ab11f1e Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 23 May 1996 16:28:10 +0000 Subject: [PATCH] Corretta data odierna git-svn-id: svn://10.65.10.50/trunk@2902 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/date.cpp | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/include/date.cpp b/include/date.cpp index 1c68f7f77..a672e2498 100755 --- a/include/date.cpp +++ b/include/date.cpp @@ -4,14 +4,12 @@ #define __DATE_CPP #include -#ifndef FOXPRO +#ifndef FOXPRO #include #endif #include #include -#if XVT_OS != XVT_OS_SCOUNIX -#include -#endif +#include #define DAYYEAR 365 #define DAYBIAS 36525L @@ -38,12 +36,12 @@ TDate::TDate(long l) : _val(l) struct tm *timeloc; FILE *f; - sprintf(_int_s1, "date.%-d", getuid()); - if ((f = fopen(_int_s1, "r")) == NULL) + sprintf(__date_tmp_string, "date.%-d", getuid()); + if ((f = fopen(__date_tmp_string, "r")) == NULL) { if (time(<) == -1) return ; timeloc = localtime(<) ; - _val = makedata(timeloc->tm_mday, timeloc->tm_mon+1, timeloc->tm_year); + _val = makedata(timeloc->tm_mday, timeloc->tm_mon+1, timeloc->tm_year + 1900); } else { @@ -51,13 +49,13 @@ TDate::TDate(long l) : _val(l) fclose(f); } #endif -#else - int junk; - union REGS inregs, outregs; +#else + time_t lt; + struct tm * timeloc; - inregs.h.ah = 0x2A; - junk = intdos(&inregs, &outregs); - _val = makedata(outregs.h.dl, outregs.h.dh, outregs.x.cx); + if (time(<) == -1) return ; + timeloc = localtime(<) ; + _val = makedata(timeloc->tm_mday, timeloc->tm_mon+1, timeloc->tm_year + 1900); #endif } else if (_val == 0) @@ -105,9 +103,9 @@ TDate::TDate(const char* s) if (i == 8) { TString16 str(s); - d = atoi(str+6); str.cut(6); - m = atoi(str+4); str.cut(4); - y = atoi(str+0); + d = atoi(((const char *)str)+6); str.cut(6); + m = atoi(((const char *)str)+4); str.cut(4); + y = atoi(((const char *)str)+0); } } else @@ -425,9 +423,9 @@ bool TDate::isdate(const char* s) if (i == 8) { TString16 str(s); - d = atoi(str+6); str.cut(6); - m = atoi(str+4); str.cut(4); - y = atoi(str+0); + d = atoi(((const char *)str)+6); str.cut(6); + m = atoi(((const char *)str)+4); str.cut(4); + y = atoi(((const char *)str)+0); } } else