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
@ -4,14 +4,12 @@
|
|||||||
|
|
||||||
#define __DATE_CPP
|
#define __DATE_CPP
|
||||||
#include <date.h>
|
#include <date.h>
|
||||||
#ifndef FOXPRO
|
#ifndef FOXPRO
|
||||||
#include <real.h>
|
#include <real.h>
|
||||||
#endif
|
#endif
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#if XVT_OS != XVT_OS_SCOUNIX
|
#include <time.h>
|
||||||
#include <dos.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DAYYEAR 365
|
#define DAYYEAR 365
|
||||||
#define DAYBIAS 36525L
|
#define DAYBIAS 36525L
|
||||||
@ -38,12 +36,12 @@ TDate::TDate(long l) : _val(l)
|
|||||||
struct tm *timeloc;
|
struct tm *timeloc;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
sprintf(_int_s1, "date.%-d", getuid());
|
sprintf(__date_tmp_string, "date.%-d", getuid());
|
||||||
if ((f = fopen(_int_s1, "r")) == NULL)
|
if ((f = fopen(__date_tmp_string, "r")) == NULL)
|
||||||
{
|
{
|
||||||
if (time(<) == -1) return ;
|
if (time(<) == -1) return ;
|
||||||
timeloc = localtime(<) ;
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -51,13 +49,13 @@ TDate::TDate(long l) : _val(l)
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
int junk;
|
time_t lt;
|
||||||
union REGS inregs, outregs;
|
struct tm * timeloc;
|
||||||
|
|
||||||
inregs.h.ah = 0x2A;
|
if (time(<) == -1) return ;
|
||||||
junk = intdos(&inregs, &outregs);
|
timeloc = localtime(<) ;
|
||||||
_val = makedata(outregs.h.dl, outregs.h.dh, outregs.x.cx);
|
_val = makedata(timeloc->tm_mday, timeloc->tm_mon+1, timeloc->tm_year + 1900);
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
if (_val == 0)
|
if (_val == 0)
|
||||||
@ -105,9 +103,9 @@ TDate::TDate(const char* s)
|
|||||||
if (i == 8)
|
if (i == 8)
|
||||||
{
|
{
|
||||||
TString16 str(s);
|
TString16 str(s);
|
||||||
d = atoi(str+6); str.cut(6);
|
d = atoi(((const char *)str)+6); str.cut(6);
|
||||||
m = atoi(str+4); str.cut(4);
|
m = atoi(((const char *)str)+4); str.cut(4);
|
||||||
y = atoi(str+0);
|
y = atoi(((const char *)str)+0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -425,9 +423,9 @@ bool TDate::isdate(const char* s)
|
|||||||
if (i == 8)
|
if (i == 8)
|
||||||
{
|
{
|
||||||
TString16 str(s);
|
TString16 str(s);
|
||||||
d = atoi(str+6); str.cut(6);
|
d = atoi(((const char *)str)+6); str.cut(6);
|
||||||
m = atoi(str+4); str.cut(4);
|
m = atoi(((const char *)str)+4); str.cut(4);
|
||||||
y = atoi(str+0);
|
y = atoi(((const char *)str)+0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user