os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winTime.test
First public contribution.
1 # This file tests the tclWinTime.c file.
3 # This file contains a collection of tests for one or more of the Tcl
4 # built-in commands. Sourcing this file into Tcl runs the tests and
5 # generates output for errors. No output means no errors were found.
7 # Copyright (c) 1997 Sun Microsystems, Inc.
8 # Copyright (c) 1998-1999 by Scriptics Corporation.
10 # See the file "license.terms" for information on usage and redistribution
11 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 # RCS: @(#) $Id: winTime.test,v 1.8.2.1 2003/04/12 20:11:34 kennykb Exp $
15 if {[lsearch [namespace children] ::tcltest] == -1} {
16 package require tcltest
17 namespace import -force ::tcltest::*
20 testConstraint testwinclock [llength [info commands testwinclock]]
22 # The next two tests will crash on Windows if the check for negative
23 # clock values is not done properly.
25 test winTime-1.1 {TclpGetDate} {pcOnly} {
27 set result [clock format -1 -format %Y]
31 test winTime-1.2 {TclpGetDate} {pcOnly} {
33 set result [clock format 1 -format %Y]
38 # Next test tries to make sure that the Tcl clock stays in step
39 # with the Windows clock. 30 sec really isn't enough,
40 # but how much time does a tester have patience for?
42 test winTime-2.1 {Synchronization of Tcl and Windows clocks} {testwinclock} {
43 # May fail due to OS/hardware discrepancies. See:
44 # http://support.microsoft.com/default.aspx?scid=kb;en-us;274323
47 foreach start_sec [testwinclock] break
49 foreach { sys_sec sys_usec tcl_sec tcl_usec } [testwinclock] break
50 set diff [expr { $tcl_sec - $sys_sec
51 + 1.0e-6 * ( $tcl_usec - $sys_usec ) }]
52 if { abs($diff) > 0.06 } {
53 set failed "Tcl clock differs from system clock by $diff sec"
58 if { $sys_sec - $start_sec >= 30 } break
64 ::tcltest::cleanupTests