Time.st
author Claus Gittinger <cg@exept.de>
Fri, 22 May 1998 12:55:12 +0200
changeset 3477 ac8613ab02c9
parent 2706 878723bc99fc
child 3478 3f1a83b35865
permissions -rw-r--r--
fixed am/pm printing
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 95
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
    13
AbstractTime subclass:#Time
993
feaa62827c41 check for territory being #us (instead of #usa) when printing
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    14
	instanceVariableNames:'timeEncoding'
feaa62827c41 check for territory being #us (instead of #usa) when printing
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    15
	classVariableNames:''
feaa62827c41 check for territory being #us (instead of #usa) when printing
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    16
	poolDictionaries:''
feaa62827c41 check for territory being #us (instead of #usa) when printing
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    17
	category:'Magnitude-General'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
2706
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    20
!Time class methodsFor:'documentation'!
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    21
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    22
copyright
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    23
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    24
 COPYRIGHT (c) 1989 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 95
diff changeset
    25
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    26
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    27
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    28
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    30
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    31
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    32
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    33
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    34
!
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    35
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    36
documentation
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    37
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    38
    Instances of time represent a particular time-of-day.
409
claus
parents: 394
diff changeset
    39
    Since they only store hours, minutes and seconds within a day,
claus
parents: 394
diff changeset
    40
    they cannot be used to compare times across midnight 
claus
parents: 394
diff changeset
    41
    (i.e. they should not be used as timeStamps).
1228
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    42
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    43
    Use instances of AbsoluteTime (and read the comment there) to do this.
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    44
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    45
    Examples:
1228
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    46
        |t|
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    47
1228
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    48
        t := Time now.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1302
diff changeset
    49
        Transcript showCR:t.
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    50
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    51
1228
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    52
        |t1 t2|
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    53
1228
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    54
        t1 := Time now.
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    55
        (Delay forSeconds:10) wait.
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    56
        t2 := Time now.
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    57
        t2 - t1   
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    58
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    59
    [author:]
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    60
        Claus Gittinger
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    61
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    62
    [see also:]
1302
b39a598b0937 documentation
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
    63
        Date AbsoluteTime AbstractTime OperatingSystem
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    64
        Filename
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    65
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    66
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    67
2706
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    68
!Time class methodsFor:'instance creation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    69
239
472f810ecccf readFrom; houtr:minutes:seconds: fixed
claus
parents: 216
diff changeset
    70
hour:h minutes:m seconds:s
1228
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    71
    "return an instance of Time representing the given time.
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    72
     See also Time now / Date today / AbsoluteTime now."
239
472f810ecccf readFrom; houtr:minutes:seconds: fixed
claus
parents: 216
diff changeset
    73
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
    74
    ^ self basicNew setHour:h minutes:m seconds:s
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    75
239
472f810ecccf readFrom; houtr:minutes:seconds: fixed
claus
parents: 216
diff changeset
    76
    "
472f810ecccf readFrom; houtr:minutes:seconds: fixed
claus
parents: 216
diff changeset
    77
     Time hour:2 minutes:33 seconds:0 
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    78
     Time hour:0 minutes:0 seconds:0 
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    79
     Time hour:24 minutes:0 seconds:0 
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    80
     Time hour:23 minutes:59 seconds:59 
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
    81
    "
1228
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    82
127d990e2f77 commentary
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    83
    "Modified: 19.4.1996 / 15:32:40 / cg"
77
6c38ca59927f *** empty log message ***
claus
parents: 62
diff changeset
    84
!
6c38ca59927f *** empty log message ***
claus
parents: 62
diff changeset
    85
569
7134eb78cf48 readFrom:onError: can now also read from a string
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    86
readFrom:aStringOrStream onError:exceptionBlock
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    87
    "return a new Time, reading a printed representation from aStream.
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
    88
     If no pm follows the time, the string is interpreted as either 24 hour format
409
claus
parents: 394
diff changeset
    89
     or being am."
239
472f810ecccf readFrom; houtr:minutes:seconds: fixed
claus
parents: 216
diff changeset
    90
1701
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
    91
    ErrorSignal handle:[:ex |
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
    92
        ^ exceptionBlock value
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
    93
    ] do:[
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
    94
        |str hour min sec ex|
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
    95
1701
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
    96
        str := aStringOrStream readStream.
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
    97
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
    98
        ex := [^ exceptionBlock value].
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
    99
1701
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   100
        hour := Integer readFrom:str onError:ex.
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   101
        (hour between:0 and:24) ifFalse:[ex value].
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   102
1701
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   103
        [str peek isDigit] whileFalse:[str next].
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   104
        min := Integer readFrom:str onError:ex.
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   105
        (min between:0 and:59) ifFalse:[ex value].
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   106
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   107
        str atEnd ifFalse:[
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   108
            [str peek isDigit] whileFalse:[str next].
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   109
            sec := Integer readFrom:str onError:ex.
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   110
            (sec between:0 and:59) ifFalse:[ex value].
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   111
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   112
            [str peek == Character space] whileTrue:[str next].
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   113
            (str peek == $p) ifTrue:[
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   114
                "pm"
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   115
                hour := hour + 12
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   116
            ].
1701
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   117
        ].
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   118
        ^ self basicNew setHour:hour minutes:min seconds:sec
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   119
    ]
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   120
239
472f810ecccf readFrom; houtr:minutes:seconds: fixed
claus
parents: 216
diff changeset
   121
    "
409
claus
parents: 394
diff changeset
   122
     Time readFrom:'18:22:00'    
claus
parents: 394
diff changeset
   123
     Time readFrom:'14:00:11'    
claus
parents: 394
diff changeset
   124
     Time readFrom:'7:00:11'     
claus
parents: 394
diff changeset
   125
     Time readFrom:'6:22:00 pm'   
claus
parents: 394
diff changeset
   126
     Time readFrom:'2:00:11 pm'  
claus
parents: 394
diff changeset
   127
     Time readFrom:'7:00:11 am'  
239
472f810ecccf readFrom; houtr:minutes:seconds: fixed
claus
parents: 216
diff changeset
   128
    "
569
7134eb78cf48 readFrom:onError: can now also read from a string
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   129
1701
80d13adb2e77 better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   130
    "Modified: 8.10.1996 / 19:32:11 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   131
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   132
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   133
!Time methodsFor:'accessing'!
77
6c38ca59927f *** empty log message ***
claus
parents: 62
diff changeset
   134
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   135
day
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   136
    "catch day access - Time does not know about it"
77
6c38ca59927f *** empty log message ***
claus
parents: 62
diff changeset
   137
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   138
    ^ self shouldNotImplement
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   139
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   140
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   141
hours
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   142
    "return the number of hours since midnight (i.e. 0..23)"
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   143
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   144
    ^ timeEncoding // 3600
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   145
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   146
    "
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   147
     Time now hours
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   148
    "
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   149
!
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   150
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   151
minutes
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   152
    "return the number of minutes within the hour (i.e. 0..59)"
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   153
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   154
    ^ (timeEncoding \\ 3600) // 60
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   155
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   156
    "
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   157
     Time now minutes
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   158
    "
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   159
!
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   160
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   161
month 
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   162
    "catch month access - Time does not know about it"
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   163
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   164
    ^ self shouldNotImplement
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   165
!
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   166
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   167
seconds
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   168
    "return the number of seconds within the minute (i.e. 0..59)"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   169
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   170
    ^ (timeEncoding \\ 3600) \\ 60
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   171
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   172
    "
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   173
     Time now seconds
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   174
    "
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   175
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   176
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   177
year
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   178
    "catch year access - Time does not know about it"
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   179
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   180
    ^ self shouldNotImplement
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   181
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   182
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   183
!Time methodsFor:'comparing'!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   184
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   185
< aTime
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   186
    "return true if the argument, aTime is before the receiver"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   187
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   188
    ^ timeEncoding < aTime timeEncoding
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   189
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   190
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   191
= aTime
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   192
    "return true if the argument, aTime represents the same timeOfDay"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   193
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   194
    aTime class == self class ifTrue:[
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   195
	^ timeEncoding == aTime timeEncoding
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   196
    ].
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   197
    (aTime species == self species) ifFalse:[^ false].
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   198
    ^ self asSeconds == aTime asSeconds
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   199
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   200
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   201
> aTime
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   202
    "return true if the argument, aTime is after the receiver"
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   203
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   204
    ^ timeEncoding > aTime timeEncoding
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   205
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   206
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   207
hash
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   208
    "return an integer useful for hashing on times"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   209
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   210
    ^ timeEncoding
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   211
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   212
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   213
!Time methodsFor:'converting'!
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   214
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   215
asAbsoluteTime
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   216
    "return an AbsoluteTime object from the receiver.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   217
     The date components are taken from today."
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   218
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   219
    |today|
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   220
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   221
    today := Date today.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   222
    ^ AbsoluteTime day:today day month:today month year:today year
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   223
		   hour:self hours minutes:self minutes seconds:self seconds
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   224
    "
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   225
     Time now asAbsoluteTime
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   226
    "
62
e1b4369c61fb *** empty log message ***
claus
parents: 32
diff changeset
   227
!
e1b4369c61fb *** empty log message ***
claus
parents: 32
diff changeset
   228
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   229
asSeconds
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   230
    "return the number of seconds elapsed since midnight"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   231
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   232
    ^ timeEncoding
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   233
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   234
    "
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   235
     Time now asSeconds
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   236
    "
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   237
!
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   238
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   239
asTime
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   240
    "return a Time object from the receiver - thats the receiver."
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   241
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   242
    ^ self
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   243
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   244
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   245
!Time methodsFor:'printing & storing'!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   246
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   247
print12HourFormatOn:aStream
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   248
    "append a printed representation of the receiver to aStream.
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   249
     Format is hh:mm:ss am/pm (i.e. 12-hour american format)."
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   250
409
claus
parents: 394
diff changeset
   251
    |h m s ampm|
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   252
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   253
    ampm := ' am'.
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   254
    h := self hours.
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   255
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   256
    "/ 0 -> 12 am
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   257
    "/ 12 -> 12 pm
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   258
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   259
    h > 12 ifTrue:[
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   260
        h := h - 12.
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   261
        ampm := ' pm'.
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   262
    ] ifFalse:[
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   263
        h == 0 ifTrue:[
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   264
            h := 12
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   265
        ] ifFalse:[
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   266
            h == 12 ifTrue:[
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   267
                ampm := ' pm'
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   268
            ]
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   269
        ]
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   270
    ].
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   271
    h printOn:aStream.
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   272
    aStream nextPut:$:.
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   273
    m := self minutes.
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   274
    (m < 10) ifTrue:[aStream nextPut:$0].
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   275
    m printOn:aStream.
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   276
    aStream nextPut:$:.
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   277
    s := self seconds.
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   278
    (s < 10) ifTrue:[aStream nextPut:$0].
409
claus
parents: 394
diff changeset
   279
    s printOn:aStream.
claus
parents: 394
diff changeset
   280
    aStream nextPutAll:ampm
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   281
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   282
    "
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   283
     Time now print12HourFormatOn:Transcript. Transcript cr
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   284
     (Time now subtractHours:12) print12HourFormatOn:Transcript. Transcript cr
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   285
     (Time hour:24 minutes:0 seconds:0) print12HourFormatOn:Transcript. Transcript cr
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   286
     (Time hour:12 minutes:0 seconds:0) print12HourFormatOn:Transcript. Transcript cr
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   287
     (Time hour:0 minutes:0 seconds:0) print12HourFormatOn:Transcript. Transcript cr
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   288
    "
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   289
!
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   290
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   291
print24HourFormatOn:aStream
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   292
    "append a printed representation of the receiver to aStream.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   293
     Format is hh:mm:ss (i.e. 24-hour european format)."
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   294
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   295
    |h m s|
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   296
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   297
    h := self hours.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   298
    (h < 10) ifTrue:[aStream nextPut:$0].
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   299
    h printOn:aStream.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   300
    aStream nextPut:$:.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   301
    m := self minutes.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   302
    (m < 10) ifTrue:[aStream nextPut:$0].
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   303
    m printOn:aStream.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   304
    aStream nextPut:$:.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   305
    s := self seconds.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   306
    (s < 10) ifTrue:[aStream nextPut:$0].
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   307
    s printOn:aStream
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   308
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   309
    "
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   310
     Time now print24HourFormatOn:Transcript. Transcript cr
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   311
    "
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   312
!
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   313
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   314
printOn:aStream
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   315
    "append a printed representation of the receiver to aStream.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   316
     Format is hh:mm:ss either in 12-hour or 24-hour format.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   317
     depending on the setting of LanguageTerritory.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   318
     I dont know what ST-80 does here (12-hour format ?)"
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   319
993
feaa62827c41 check for territory being #us (instead of #usa) when printing
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   320
    LanguageTerritory == #us ifTrue:[
feaa62827c41 check for territory being #us (instead of #usa) when printing
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   321
        self print12HourFormatOn:aStream
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   322
    ] ifFalse:[
993
feaa62827c41 check for territory being #us (instead of #usa) when printing
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   323
        self print24HourFormatOn:aStream
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   324
    ]
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   325
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   326
    "
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   327
     Time now printOn:Transcript. Transcript cr
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   328
    "
993
feaa62827c41 check for territory being #us (instead of #usa) when printing
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   329
feaa62827c41 check for territory being #us (instead of #usa) when printing
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   330
    "Modified: 22.2.1996 / 16:58:30 / cg"
2706
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   331
!
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   332
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   333
shortPrintString
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   334
    "dummy - for now"
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   335
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   336
    ^ self printString
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   337
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   338
    "Created: 20.6.1997 / 17:17:01 / cg"
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   339
! !
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   340
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   341
!Time methodsFor:'private'!
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   342
1502
b334a6f69344 time changes
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   343
fromOSTime:osTime
b334a6f69344 time changes
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   344
    "set my time, given an osTime"
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   345
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   346
    |h m s|
1502
b334a6f69344 time changes
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   347
b334a6f69344 time changes
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   348
    OperatingSystem computeTimePartsOf:osTime for:[
b334a6f69344 time changes
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   349
        :hours :minutes :secs :millis |
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   350
1502
b334a6f69344 time changes
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   351
        h := hours.
b334a6f69344 time changes
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   352
        m := minutes.
b334a6f69344 time changes
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   353
        s := secs.
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   354
    ].
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   355
    self setHour:h minutes:m seconds:s
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   356
1502
b334a6f69344 time changes
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
   357
    "Modified: 1.7.1996 / 15:21:06 / cg"
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   358
!
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   359
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   360
getMilliseconds
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   361
    ^ self getSeconds * 1000
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   362
!
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   363
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   364
getSeconds
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   365
    ^ timeEncoding
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   366
!
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   367
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   368
setHour:h minutes:m seconds:s
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   369
    "set my time given individual values"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   370
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   371
    self setSeconds:(((h\\24) * 60 * 60 ) + (m * 60) + s).
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   372
!
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   373
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   374
setMilliseconds:millis
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   375
    "set my time given milliseconds since midnight"
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   376
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   377
    self setSeconds:(millis // 1000)
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   378
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   379
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   380
setSeconds:secs
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   381
    "set my time given seconds since midnight"
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   382
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   383
    secs < 0 ifTrue:[
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   384
        timeEncoding := (24 * 3600) - (secs negated \\ (24 * 3600))
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   385
    ] ifFalse:[
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   386
        timeEncoding := secs
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   387
    ]
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   388
!
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   389
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   390
timeEncoding
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   391
    "the internal encoding is stricktly private, 
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   392
     and should not be used outside."
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   393
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   394
    ^ timeEncoding
275
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   395
!
a76029ddaa98 *** empty log message ***
claus
parents: 241
diff changeset
   396
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   397
timeEncoding:encoding
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   398
    "the internal encoding is stricktly private, 
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   399
     and should not be used outside."
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   400
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   401
    timeEncoding := encoding
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   402
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   403
2706
878723bc99fc added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   404
!Time class methodsFor:'documentation'!
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   405
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   406
version
3477
ac8613ab02c9 fixed am/pm printing
Claus Gittinger <cg@exept.de>
parents: 2706
diff changeset
   407
    ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.32 1998-05-22 10:55:12 cg Exp $'
241
6f30be88e314 *** empty log message ***
claus
parents: 239
diff changeset
   408
! !