Commit 721d910c authored by Jim Fulton's avatar Jim Fulton

There internal function TimeStamp_abst was used inconsistently and

called TimeStamp_yad inconsistently.  Now both TimeStamp_abst and
TimeStamp_yad are called with "0-based" non-adjusted years.
parent fc36b9ec
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
static char TimeStamp_module_documentation[] = static char TimeStamp_module_documentation[] =
"" ""
"\n$Id: TimeStamp.c,v 1.5 1999/07/13 21:12:54 jim Exp $" "\n$Id: TimeStamp.c,v 1.6 2000/03/06 21:09:14 jim Exp $"
; ;
#include <stdlib.h> #include <stdlib.h>
...@@ -118,6 +118,8 @@ TimeStamp_yad(int y) ...@@ -118,6 +118,8 @@ TimeStamp_yad(int y)
{ {
double d, s; double d, s;
y -= 1900;
d=(y-1)*365; d=(y-1)*365;
if (y > 0) if (y > 0)
{ {
...@@ -166,8 +168,8 @@ TimeStamp_init_gmoff() ...@@ -166,8 +168,8 @@ TimeStamp_init_gmoff()
return -1; return -1;
} }
gmoff=TimeStamp_abst( gmoff=TimeStamp_abst(
t->tm_year, t->tm_mon, t->tm_mday-1, t->tm_hour*60+t->tm_min, t->tm_year+1900, t->tm_mon, t->tm_mday-1,
t->tm_sec); t->tm_hour*60+t->tm_min, t->tm_sec);
sconv=((double)60)/((double)(1<<16))/((double)(1<<16)); sconv=((double)60)/((double)(1<<16))/((double)(1<<16));
return 0; return 0;
...@@ -287,7 +289,7 @@ TimeStamp_timeTime(TimeStamp *self, PyObject *args) ...@@ -287,7 +289,7 @@ TimeStamp_timeTime(TimeStamp *self, PyObject *args)
TimeStamp_parts(self); TimeStamp_parts(self);
return PyFloat_FromDouble( return PyFloat_FromDouble(
TimeStamp_abst(TimeStamp_y-1900, TimeStamp_m-1, TimeStamp_d-1, TimeStamp_abst(TimeStamp_y, TimeStamp_m-1, TimeStamp_d-1,
TimeStamp_mi, 0)+ TimeStamp_mi, 0)+
TimeStamp_sec(self)-gmoff TimeStamp_sec(self)-gmoff
); );
...@@ -486,7 +488,7 @@ void ...@@ -486,7 +488,7 @@ void
initTimeStamp() initTimeStamp()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.5 $"; char *rev="$Revision: 1.6 $";
if (TimeStamp_init_gmoff() < 0) return; if (TimeStamp_init_gmoff() < 0) return;
if (! ExtensionClassImported) return; if (! ExtensionClassImported) return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment