TUtimeFmt TCL UTILITIES USER MANUAL TUtimeFmt
SYNOPSIS
Change the format of a time
PACKAGE
TCLUTILS
NAME
TUtimeFmt
USAGE
TUtimeFmt  tFmT T1 T2 {T3} {T4} {T5} {T6} {T7} {T8} {T9} {T10} {T11} {T12} {T13} {T14}
INPUT DEFINITIONS
tFmt - The format of the input times.
0 - Year Day Microsecond
1 - Year Day Microsecond Nanosecond
2 - Year Day
3 - Year Day Hour
4 - Year Day Hour Minute
5 - Year Day Hour Minute Second
6 - Year Day Hour Minute Second Millisecond
6 - Year Day Hour Minute Second Millisecond Nanosecond
T1 - Input time field. This can be either the full specification of the first time input as a list of the year associated with the first time.
T2 - Input time field. If T1 is specified as a list of the elements associated with the the first input time then this is a list of the elements associated with the second time. If not then this is the day of year associates with the first time.
T3 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T4 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T5 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T6 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T7 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T8 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T9 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T10 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T11 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T12 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T13 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
T14 - This is an optional input which is used only if needed. It's defintion depends on tFmt and can be determined from the table presented in the DESCRIPTION section below.
RETURN DEFINITION
Returns 1 if the first input time is later than the second, 0 it the times are identical, and -1 if the first input time is less that the second.
DESCRIPTION
TUtimeFmt compares two input times and determines if the first input time is earlier than, equal to, or later than the second input time. The comparison is performed as a string comparison and the routine returns 1 if the first input time is later than the second, 0 if they are equal, and -1 if the first input time is earlier than the second. The input times can be given in multiple formats and are input into the routine either as lists or as a sequence of the individual time fields. Then entered as list the first time is entered in the variable T1 and the second time in the variable T2. When entered as a sequence for time fields the input variables depend the specified time format tFmt and are defined in the table below where a Yr, Dy, Hr, Mn, Sc, Ms, and Ns indicate year, day of year, hour, minute, second, millisecond, and nanosecond respectively and a leading b indicates a time element associated with the first time definition and a leading e the second time definition.
tFmt INPUT
T1 T3 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14
0 bYr bDy bMs eYr eDy eMs
1 bYr bDy bMs bNs eYr eDy eMs eNs
2 bYr bDy eYr eDy
3 bYr bDy bHr eYr eDy eHr
4 bYr bDy bHr bMn eYr eDy eHr eMn
5 bYr bDy bHr bMn bSc eYr eDy eHr eMn eSc
6 bYr bDy bHr bMn bSc bMs eYr eDy eHr eMn eSc eMs
7 bYr bDy bHr bMn bSc bMs bNs eYr eDy eHr eMn eSc eMs eNs
NOTE: In formats 0 and 1 milliseconds is milliseconds of day while in formats 6 and 7 it is the integral portion of the fractional seconds multiplied by 1000. Nanoseconds are always defined as the integral portion of the fractional milliseconds multiplied by 106. In this way 10.1234567 seconds becomes Sc = 10, Ms = 123, Ns = 456700.
ERRORS
None Generated
C BACKING
No
EXAMPLE(S)
# Time Comparisons

set A(-1) "IS EARLIER THAN"
set A(0)  "IS EQUAL TO"
set A(1)  "IS LATER THAN"
                                                                                
# Pair of times as lists with time formt 6

set T1 [list 2004 98 10 15 35 786]
set T2 [list 2004 98 10 14 35 286]

# COMPARISON

set CmP $A([TUtimeFmt 6 $T1 $T2]) 
puts stderr "2004 98 10:15:35.786 $CmP 2004 98 10:14:35.286"

# Times input a individual fields using format 5

set CmP $A([TUtimeFmt 5 2001 10 22 19 36 2001 11 1 2 22]) 
puts stderr "2001 10 22:19:36 $CmP 2001 11 01:02:22"

> 2004 98 10:15:35.786 IS LATER THAN 2004 98 10:14:35.286
> 2001 10 22:19:36 IS EARLIER THAN 2001 11 01:02:22

      
Oct 23, 2006