1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
-
+
|
/*
* tclDate.c --
*
* This file is generated from a yacc grammar defined in
* the file tclGetDate.y. It should not be edited directly.
*
* Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans.
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclDate.c,v 1.4 1999/04/16 00:46:45 stanton Exp $
* RCS: @(#) $Id: tclDate.c,v 1.5 1999/05/14 18:29:50 stanton Exp $
*/
#include "tclInt.h"
#include "tclPort.h"
#ifdef MAC_TCL
# define EPOCH 1904
|
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
|
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
|
-
+
+
-
+
+
|
|| Day < 1 || Day > DaysInMonth[(int)--Month])
return -1;
for (Julian = Day - 1, i = 0; i < Month; i++)
Julian += DaysInMonth[i];
if (Year >= EPOCH) {
for (i = EPOCH; i < Year; i++)
Julian += 365 + (i % 4 == 0);
Julian += 365 + (((i % 4) == 0) &&
(((i % 100) != 0) || ((i % 400) == 0)));
} else {
for (i = Year; i < EPOCH; i++)
Julian -= 365 + (i % 4 == 0);
Julian -= 365 + (((i % 4) == 0) &&
(((i % 100) != 0) || ((i % 400) == 0)));
}
Julian *= SECSPERDAY;
Julian += TclDateTimezone * 60L;
if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
return -1;
Julian += tod;
if (DSTmode == DSTon
|