Corretta data odierna
git-svn-id: svn://10.65.10.50/trunk@2902 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
77b703f859
commit
a1790f54ab
@ -9,9 +9,7 @@
|
||||
#endif
|
||||
#include <strings.h>
|
||||
#include <utility.h>
|
||||
#if XVT_OS != XVT_OS_SCOUNIX
|
||||
#include <dos.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
#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
|
||||
{
|
||||
@ -52,12 +50,12 @@ TDate::TDate(long l) : _val(l)
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
int junk;
|
||||
union REGS inregs, outregs;
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user