Diff
Not logged in

Differences From Artifact [c989596096]:

To Artifact [c815750671]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 
 * tclWinTime.c --
 *
 *	Contains Windows specific versions of Tcl functions that
 *	obtain time values from the operating system.
 *
 * Copyright 1995-1998 by 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: tclWinTime.c,v 1.20 2003/08/27 19:50:07 davygrvy Exp $
 */

#include "tclWinInt.h"

#define SECSPERDAY (60L * 60L * 24L)
#define SECSPERYEAR (SECSPERDAY * 365L)
#define SECSPER4YEAR (SECSPERYEAR * 4L + SECSPERDAY)











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 
 * tclWinTime.c --
 *
 *	Contains Windows specific versions of Tcl functions that
 *	obtain time values from the operating system.
 *
 * Copyright 1995-1998 by 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: tclWinTime.c,v 1.21 2003/12/16 02:55:38 davygrvy Exp $
 */

#include "tclWinInt.h"

#define SECSPERDAY (60L * 60L * 24L)
#define SECSPERYEAR (SECSPERDAY * 365L)
#define SECSPER4YEAR (SECSPERYEAR * 4L + SECSPERDAY)
557
558
559
560
561
562
563












564

565
566
567
568
569
570
571

	/*
	 * If we are in the valid range, let the C run-time library
	 * handle it.  Otherwise we need to fake it.  Note that this
	 * algorithm ignores daylight savings time before the epoch.
	 */













	if (*tp >= 0) {

	    return localtime(tp);
	}

	time = *tp - timezone;
	
	/*
	 * If we aren't near to overflowing the long, just add the bias and







>
>
>
>
>
>
>
>
>
>
>
>

>







557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584

	/*
	 * If we are in the valid range, let the C run-time library
	 * handle it.  Otherwise we need to fake it.  Note that this
	 * algorithm ignores daylight savings time before the epoch.
	 */

	/*
	  Hm, Borland's localtime manages to return NULL under certain
	  circumstances (e.g. wintime.test, test 1.2). Nobody tests for this,
	  since 'localtime' isn't supposed to do this, possibly leading to
	  crashes.
	  Patch: We only call this function if we are at least one day into
	  the epoch, else we handle it ourselves (like we do for times < 0).
	  H. Giese, June 2003
	*/
#ifdef __BORLANDC__
	if (*tp >= SECSPERDAY) {
#else
	if (*tp >= 0) {
#endif
	    return localtime(tp);
	}

	time = *tp - timezone;
	
	/*
	 * If we aren't near to overflowing the long, just add the bias and