AbstractTime.st
author Claus Gittinger <cg@exept.de>
Tue, 26 Feb 2002 12:34:29 +0100
changeset 6419 5cf00f5e656d
parent 6172 a3c88ea5efe9
child 6795 519894240d97
permissions -rw-r--r--
more ANSI compatibility
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
     1
"
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
     3
	      All Rights Reserved
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
     4
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    11
"
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    12
5548
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
    13
"{ Package: 'stx:libbasic' }"
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
    14
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    15
Magnitude subclass:#AbstractTime
1227
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    16
	instanceVariableNames:''
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    17
	classVariableNames:''
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    18
	poolDictionaries:''
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    19
	category:'Magnitude-General'
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    20
!
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    21
2310
2cb1366e0eb3 Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents: 1500
diff changeset
    22
!AbstractTime class methodsFor:'documentation'!
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    23
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    24
copyright
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    25
"
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    27
	      All Rights Reserved
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    28
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    29
 This software is furnished under a license and may be used
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    34
 hereby transferred.
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    35
"
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    36
!
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    37
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    38
documentation
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    39
"
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
    40
    This is an abstract class providing common protocol for Time (time in day)
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
    41
    and AbsoluteTime (time plus day).
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
    42
    There are no instances of this class in the system.
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
    43
    It is meant as a home for methods common to time handling classes.
1282
3f5eda57c516 commentary
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
    44
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1282
diff changeset
    45
    [author:]
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1282
diff changeset
    46
        Claus Gittinger
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1282
diff changeset
    47
1282
3f5eda57c516 commentary
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
    48
    [See also:]
3f5eda57c516 commentary
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
    49
        Time Date AbsoluteTime
3f5eda57c516 commentary
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
    50
        Delay ProcessorScheduler
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
    51
"
6172
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    52
!
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    53
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    54
iso8601Format
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    55
"
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    56
  Abstract
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    57
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    58
    This document defines a profile of ISO 8601, the International Standard for the representation of dates and times. ISO
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    59
    8601 describes a large number of date/time formats. To reduce the scope for error and the complexity of software, it is
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    60
    useful to restrict the supported formats to a small number. This profile defines a few date/time formats, likely to satisfy
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    61
    most requirements. 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    62
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    63
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    64
  Formats
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    65
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    66
    Different standards may need different levels of granularity in the date and time, so this profile defines six levels.
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    67
    Standards that reference this profile should specify one or more of these granularities. If a given standard allows more
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    68
    than one granularity, it should specify the meaning of the dates and times with reduced precision, for example, the result
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    69
    of comparing two dates with different precisions.
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    70
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    71
    The formats are as follows. Exactly the components shown here must be present, with exactly this punctuation. Note
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    72
    that the 'T' appears literally in the string, to indicate the beginning of the time element, as specified in ISO 8601. 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    73
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    74
       Year:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    75
          YYYY (eg 1997)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    76
       Year and month:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    77
          YYYY-MM (eg 1997-07)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    78
       Complete date:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    79
          YYYY-MM-DD (eg 1997-07-16)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    80
       Complete date plus hours and minutes:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    81
          YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    82
       Complete date plus hours, minutes and seconds:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    83
          YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    84
       Complete date plus hours, minutes, seconds and a decimal fraction of a
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    85
    second
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    86
          YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    87
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    88
    where:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    89
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    90
         YYYY = four-digit year
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    91
         MM   = two-digit month (01=January, etc.)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    92
         DD   = two-digit day of month (01 through 31)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    93
         hh   = two digits of hour (00 through 23) (am/pm NOT allowed)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    94
         mm   = two digits of minute (00 through 59)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    95
         ss   = two digits of second (00 through 59)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    96
         s    = one or more digits representing a decimal fraction of a second
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    97
         TZD  = time zone designator (Z or +hh:mm or -hh:mm)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    98
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
    99
    This profile does not specify how many digits may be used to represent the decimal fraction of a second. An adopting
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   100
    standard that permits fractions of a second must specify both the minimum number of digits (a number greater than or
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   101
    equal to one) and the maximum number of digits (the maximum may be stated to be 'unlimited').
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   102
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   103
    This profile defines two ways of handling time zone offsets:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   104
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   105
       1.Times are expressed in UTC (Coordinated Universal Time), with a special UTC designator ('Z'). 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   106
       2.Times are expressed in local time, together with a time zone offset in hours and minutes. A time zone offset of
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   107
         '+hh:mm' indicates that the date/time uses a local time zone which is 'hh' hours and 'mm' minutes ahead of
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   108
         UTC. A time zone offset of '-hh:mm' indicates that the date/time uses a local time zone which is 'hh' hours and
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   109
         'mm' minutes behind UTC. 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   110
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   111
    A standard referencing this profile should permit one or both of these ways of handling time zone offsets.
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   112
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   113
  The ISO8601 printString are generated with:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   114
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   115
       Year:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   116
          YYYY (eg 1997)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   117
                Date today printStringFormat:'%(year)'
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   118
                AbsoluteTime now printStringFormat:'%(year)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   119
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   120
       Year and month:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   121
          YYYY-MM (eg 1997-07)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   122
                Date today printStringFormat:'%(year)-%(month)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   123
                AbsoluteTime now printStringFormat:'%(year)-%(month)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   124
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   125
       Complete date:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   126
          YYYY-MM-DD (eg 1997-07-16)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   127
                Date today printStringFormat:'%(year)-%(month)-%(day)'    
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   128
                AbsoluteTime now printStringFormat:'%(year)-%(month)-%(day)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   129
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   130
       Complete date plus hours and minutes:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   131
          YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   132
                AbsoluteTime now printStringFormat:'%(year)-%(month)-%(day)T%h:%m%(TZD)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   133
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   134
       Complete date plus hours, minutes and seconds:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   135
          YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   136
                AbsoluteTime now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s%(TZD)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   137
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   138
       Complete date plus hours, minutes, seconds and a decimal fraction of a second
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   139
          YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   140
                AbsoluteTime now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s.%(milli2)%(TZD)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   141
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   142
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   143
"
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   144
! !
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   145
2310
2cb1366e0eb3 Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents: 1500
diff changeset
   146
!AbstractTime class methodsFor:'instance creation'!
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   147
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   148
dateAndTimeNow
1227
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   149
    "return an array filled with the current date and time.
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   150
     See also: Date today / Time now / AbsoluteTime now."
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   151
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   152
    ^ Array with:(Date today) with:(Time now)
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   153
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   154
    "
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   155
     Time dateAndTimeNow
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   156
    "
1227
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   157
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   158
    "Modified: 19.4.1996 / 15:23:37 / cg"
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   159
!
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   160
1227
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   161
now
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   162
    "return an instance of myself representing this moment."
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   163
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   164
    ^ self basicNew fromOSTime:(OperatingSystem getOSTime)
1227
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   165
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   166
    "
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   167
     AbsoluteTime now   
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   168
     Time now   
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   169
    "
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   170
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   171
    "Modified: 1.7.1996 / 15:20:10 / cg"
1227
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   172
! !
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   173
5964
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5829
diff changeset
   174
!AbstractTime class methodsFor:'Compatibility - VW'!
1227
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   175
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   176
totalSeconds
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   177
    "returns an internal second clock. Dont interpret the returned
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   178
     value - if at all, use it to compute time deltas, by subtracting
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   179
     returned values."
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   180
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   181
    ^ self secondClock
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   182
! !
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   183
2310
2cb1366e0eb3 Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents: 1500
diff changeset
   184
!AbstractTime class methodsFor:'private instance creation'!
1227
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   185
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   186
fromOSTime:osTime
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   187
    "return a time, representing the time given by the operatingSystem time.
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   188
     Not meant for public use."
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   189
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   190
    ^ self basicNew fromOSTime:osTime.
418
claus
parents: 384
diff changeset
   191
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   192
    "Modified: 1.7.1996 / 15:09:54 / cg"
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   193
!
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   194
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   195
fromSeconds:seconds
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   196
    "return an instance that is constructed from seconds.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   197
     This method is only allowed for second values as returned by
1227
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   198
     getSeconds, possibly adding/subtracting to that. 
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   199
     Never depend on any specific interpretation of the seconds,
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   200
     since it depends on how the OperatingSystem counts time
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   201
     (some start at 1900, others with 1970 ...)"
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   202
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   203
   ^ self basicNew setSeconds:seconds
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   204
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   205
    "
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   206
     Time fromSeconds:0             should return midnight
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   207
     AbsoluteTime fromSeconds:0     on UNIX: returns 1st. Jan 1970
1227
e89b39909085 commentary & category changes
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   208
                                    on others: dont know
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   209
     (AbsoluteTime day:1 month:1 year:1970 hour:1 minutes:0 seconds:0)
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   210
        getSeconds                  on UNIX: returns 0
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   211
                                    on others: dont know
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   212
    "
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   213
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   214
    "Modified: 1.7.1996 / 13:39:30 / cg"
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   215
! !
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   216
2310
2cb1366e0eb3 Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents: 1500
diff changeset
   217
!AbstractTime class methodsFor:'queries'!
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   218
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   219
millisecondClockValue
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   220
    "return the millisecond clock - since this one overruns
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   221
     regularly, use the value only for short timing deltas.
5730
b377ec6357e7 comment
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
   222
     Also remember that it wraps when comparing these values."
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   223
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   224
    ^ OperatingSystem getMillisecondTime.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   225
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   226
    "
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   227
     Time millisecondClockValue 
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   228
    "
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   229
!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   230
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   231
secondClock
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   232
    "return seconds of now - for GNU-ST compatibility"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   233
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   234
    ^ OperatingSystem getOSTime // 1000
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   235
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   236
    "
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   237
     AbstractTime secondClock    
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   238
    "
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   239
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   240
    "Modified: 1.7.1996 / 15:20:14 / cg"
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   241
! !
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   242
2310
2cb1366e0eb3 Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents: 1500
diff changeset
   243
!AbstractTime class methodsFor:'timing evaluations'!
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   244
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   245
millisecondsToRun:aBlock
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   246
    "evaluate the argument, aBlock; return the number of milliseconds it took"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   247
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   248
    |startTime endTime|
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   249
1476
02f69251f5bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   250
    startTime := OperatingSystem getMillisecondTime.
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   251
    aBlock value.
1476
02f69251f5bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   252
    endTime := OperatingSystem getMillisecondTime.
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   253
    ^ endTime - startTime
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   254
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   255
    "
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   256
     Time millisecondsToRun:[100 factorial]  
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   257
    "
1476
02f69251f5bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   258
02f69251f5bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
   259
    "Modified: 17.6.1996 / 16:57:37 / cg"
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   260
!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   261
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   262
secondsToRun:aBlock
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   263
    "evaluate the argument, aBlock; return the number of seconds it took"
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   264
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   265
    |startTime endTime|
360
claus
parents: 275
diff changeset
   266
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   267
    startTime := self secondClock.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   268
    aBlock value.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   269
    endTime := self secondClock.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   270
    ^ endTime - startTime
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   271
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   272
    "
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   273
     Time secondsToRun:[1000 factorial]  
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   274
    "
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   275
! !
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   276
6419
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   277
!AbstractTime methodsFor:'Compatibility - ANSI'!
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   278
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   279
hour12
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   280
    "return the hour (1..12)."
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   281
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   282
    ^ self hours - 1 \\ 12 + 1.
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   283
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   284
    "
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   285
     Time now hour12   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   286
     Time now hour24   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   287
     (Time hours:0 minutes:0 seconds:0) hour24   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   288
     (Time hours:0 minutes:0 seconds:0) hour12   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   289
     (Time hours:1 minutes:0 seconds:0) hour24   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   290
     (Time hours:1 minutes:0 seconds:0) hour12   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   291
     (Time hours:12 minutes:0 seconds:0) hour24 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   292
     (Time hours:12 minutes:0 seconds:0) hour12   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   293
     (Time hours:13 minutes:0 seconds:0) hour24 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   294
     (Time hours:13 minutes:0 seconds:0) hour12   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   295
     (Time hours:23 minutes:0 seconds:0) hour24 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   296
     (Time hours:23 minutes:0 seconds:0) hour12   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   297
     (Time hours:24 minutes:0 seconds:0) hour24 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   298
     (Time hours:24 minutes:0 seconds:0) hour12   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   299
    "
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   300
!
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   301
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   302
hour24
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   303
    "return the hour (0..23)."
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   304
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   305
    ^ self hours
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   306
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   307
    "
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   308
     Time now hour12   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   309
     Time now hour24   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   310
     (Time hours:0 minutes:0 seconds:0) hour24 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   311
     (Time hours:0 minutes:0 seconds:0) hour12 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   312
     (Time hours:1 minutes:0 seconds:0) hour24 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   313
     (Time hours:1 minutes:0 seconds:0) hour12 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   314
     (Time hours:12 minutes:0 seconds:0) hour24 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   315
     (Time hours:12 minutes:0 seconds:0) hour12 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   316
     (Time hours:13 minutes:0 seconds:0) hour24 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   317
     (Time hours:13 minutes:0 seconds:0) hour12 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   318
     (Time hours:23 minutes:0 seconds:0) hour24 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   319
     (Time hours:23 minutes:0 seconds:0) hour12 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   320
     (Time hours:24 minutes:0 seconds:0) hour24 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   321
     (Time hours:24 minutes:0 seconds:0) hour12 
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   322
    "
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   323
!
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   324
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   325
meridianAbbreviation
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   326
    "am/pm"
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   327
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   328
    self hours // 12 == 0 ifTrue:[
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   329
        ^ 'am'.
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   330
    ] ifFalse:[
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   331
        ^ 'pm'.
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   332
    ].
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   333
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   334
    "
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   335
     Time now meridianAbbreviation   
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   336
     (Time hours:0 minutes:0 seconds:0) meridianAbbreviation  
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   337
     (Time hours:11 minutes:59 seconds:59) meridianAbbreviation  
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   338
     (Time hours:12 minutes:0 seconds:0) meridianAbbreviation    
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   339
     (Time hours:12 minutes:0 seconds:1) meridianAbbreviation  
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   340
    "
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   341
! !
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   342
6172
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   343
!AbstractTime methodsFor:'abstract'!
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   344
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   345
hours
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   346
    "return the hours (0..23)"
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   347
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   348
    ^ self subclassResponsibility
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   349
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   350
    "
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   351
     AbsoluteTime now hours 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   352
     Time now hours 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   353
    "
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   354
!
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   355
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   356
milliseconds
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   357
    "return the milliseconds (0..999)"
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   358
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   359
    ^ self subclassResponsibility
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   360
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   361
    "
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   362
     AbsoluteTime now milliseconds 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   363
     Time now milliseconds 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   364
    "
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   365
!
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   366
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   367
minutes
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   368
    "return the minutes (0..59)"
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   369
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   370
    ^ self minutes.
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   371
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   372
    "
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   373
     AbsoluteTime now minutes 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   374
     Time now minutes 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   375
    "
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   376
!
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   377
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   378
seconds
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   379
    "return the seconds (0..59)"
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   380
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   381
    ^ self subclassResponsibility
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   382
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   383
    "
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   384
     AbsoluteTime now seconds 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   385
     Time now seconds 
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   386
    "
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   387
! !
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   388
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   389
!AbstractTime methodsFor:'accessing'!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   390
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   391
hourInDay
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   392
    "return the hours (0..23)"
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   393
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   394
    ^ self hours
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   395
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   396
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   397
     AbsoluteTime now hourInDay 
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   398
     Time now hourInDay 
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   399
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   400
!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   401
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   402
minuteInDay
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   403
    "return the minutes (0..59)"
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   404
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   405
    ^ self minutes.
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   406
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   407
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   408
     AbsoluteTime now minuteInDay 
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   409
     Time now minuteInDay 
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   410
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   411
!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   412
2310
2cb1366e0eb3 Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents: 1500
diff changeset
   413
secondInDay
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   414
    "return the seconds (0..59)"
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   415
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   416
    ^ self seconds
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   417
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   418
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   419
     AbsoluteTime now secondInDay 
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   420
     Time now seconds 
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   421
    "
2310
2cb1366e0eb3 Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents: 1500
diff changeset
   422
2cb1366e0eb3 Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents: 1500
diff changeset
   423
    "Created: 22.10.1996 / 09:27:47 / stefan"
5548
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   424
!
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   425
6172
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   426
timeZoneDeltaInMinutes
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   427
    ^ 0
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   428
!
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   429
5968
4832ed93f0b4 preps for timeZone
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
   430
timeZoneName
4832ed93f0b4 preps for timeZone
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
   431
    ^ 'utc'
4832ed93f0b4 preps for timeZone
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
   432
!
4832ed93f0b4 preps for timeZone
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
   433
5548
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   434
weekInYear
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   435
    "return the week number of the receiver - 1 for Jan, 1st."
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   436
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   437
    ^ Date weekInYearOf:self
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   438
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   439
    "
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   440
     (AbsoluteTime newDay:1 year:2000) weekInYear    
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   441
     (AbsoluteTime newDay:2 year:2000) weekInYear    
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   442
     (AbsoluteTime newDay:3 year:2000) weekInYear    
eead51e4752e added #weekInYear query
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   443
    "
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   444
! !
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   445
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   446
!AbstractTime methodsFor:'arithmetic'!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   447
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   448
- aTime
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   449
    "return the delta in seconds between 2 times."
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   450
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   451
    ^ self getSeconds - (aTime getSeconds)
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   452
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   453
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   454
     |t1 t2|
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   455
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   456
     t1 := AbsoluteTime now.
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   457
     (Delay forSeconds:5) wait.
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   458
     t2 := AbsoluteTime now.
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   459
     Transcript showCR:('seconds passed: ' , (t2 - t1) printString).
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   460
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   461
!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   462
6048
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   463
addDays:numberOfDays
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   464
    "return a new instance of myself, numberOfDays afterwards."
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   465
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   466
    ^ self addSeconds:(numberOfDays * (60 * 60 * 24))
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   467
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   468
    "
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   469
     |t|
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   470
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   471
     t := AbsoluteTime now.
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   472
     Transcript showCR:t.
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   473
     Transcript showCR:(t addDays:7)
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   474
    "
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   475
!
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   476
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   477
addHours:numberOfHours
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   478
    "return a new instance of myself, numberOfHours afterwards."
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   479
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   480
    ^ self addSeconds:(numberOfHours * (60 * 60))
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   481
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   482
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   483
     |t|
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   484
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   485
     t := AbsoluteTime now.
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   486
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   487
     Transcript showCR:(t addHours:12).
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   488
    "
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   489
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   490
    "
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   491
     |t|
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   492
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   493
     t := Time now.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   494
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   495
     Transcript showCR:(t addHours:12).
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   496
    "
6043
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   497
!
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   498
6043
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   499
addMilliseconds:numberOfMilliSeconds
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   500
    "return a new instance of myself, numberOfMilliSeconds afterwards."
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   501
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   502
    ^ self species basicNew 
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   503
        setMilliseconds:(self getMilliseconds + numberOfMilliSeconds)
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   504
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   505
    "
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   506
     |t|
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   507
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   508
     t := AbsoluteTime now.
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   509
     Transcript showCR:t.
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   510
     Transcript showCR:(t addMilliseconds:100).
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   511
    "
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   512
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   513
    "
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   514
     |t|
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   515
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   516
     t := Time now.
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   517
     Transcript showCR:t.
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   518
     Transcript showCR:(t addMilliseconds:1000).
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   519
    "
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   520
!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   521
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   522
addMinutes:numberOfMinutes
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   523
    "return a new instance of myself, numberOfMinutes afterwards."
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   524
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   525
    ^ self addSeconds:(numberOfMinutes * 60)
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   526
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   527
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   528
     |t|
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   529
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   530
     t := AbsoluteTime now.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   531
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   532
     Transcript showCR:(t addMinutes:60).
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   533
    "
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   534
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   535
    "
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   536
     |t|
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   537
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   538
     t := Time now.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   539
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   540
     Transcript showCR:(t addMinutes:60).
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   541
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   542
!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   543
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   544
addSeconds:numberOfSeconds
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   545
    "return a new instance of myself, numberOfSeconds afterwards."
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   546
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   547
    ^ self species basicNew 
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   548
        setMilliseconds:(self getMilliseconds + (numberOfSeconds * 1000))
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   549
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   550
    "
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   551
     |t|
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   552
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   553
     t := AbsoluteTime now.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   554
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   555
     Transcript showCR:(t addSeconds:60).
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   556
    "
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   557
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   558
    "
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   559
     |t|
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   560
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   561
     t := Time now.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   562
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   563
     Transcript showCR:(t addSeconds:60).
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   564
    "
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   565
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   566
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   567
addTime:timeAmount
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   568
    "return a new instance of myself, timeAmount seconds afterwards.
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   569
     Provided for ST-80 compatibility.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   570
     WARNING:
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   571
        AddTime is a bad name - it does not add a time, but expects
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   572
        a numberOfSeconds as argument. 
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   573
        Use any of addSeconds/addHours etc. to make things clear"
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   574
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   575
    ^ self addSeconds:timeAmount
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   576
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   577
6048
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   578
subtractDays:numberOfDays
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   579
    "return a new instance of myself, numberOfDays before."
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   580
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   581
    ^ self subtractSeconds:(numberOfDays * (60 * 60 * 24))
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   582
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   583
    "
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   584
     |t|
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   585
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   586
     t := AbsoluteTime now.
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   587
     Transcript showCR:t.
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   588
     Transcript showCR:(t subtractDays:50)
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   589
    "
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   590
!
af4b1127f362 refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
   591
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   592
subtractHours:numberOfHours
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   593
    "return a new instance of myself, numberOfHours before."
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   594
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   595
    ^ self subtractSeconds:(numberOfHours * (60 * 60))
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   596
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   597
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   598
     |t|
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   599
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   600
     t := AbsoluteTime now.
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   601
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   602
     Transcript showCR:(t subtractHours:12).
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   603
    "
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   604
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   605
    "
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   606
     |t|
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   607
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   608
     t := Time now.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   609
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   610
     Transcript showCR:(t subtractHours:12).
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   611
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   612
!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   613
6043
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   614
subtractMilliseconds:numberOfMilliSeconds
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   615
    "return a new instance of myself, numberOfMilliSeconds before."
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   616
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   617
    ^ self species basicNew 
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   618
        setMilliseconds:(self getMilliseconds - numberOfMilliSeconds)
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   619
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   620
    "
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   621
     |t|
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   622
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   623
     t := AbsoluteTime now.
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   624
     Transcript showCR:t.
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   625
     Transcript showCR:(t subtractMilliseconds:100).
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   626
    "
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   627
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   628
    "
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   629
     |t|
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   630
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   631
     t := Time now.
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   632
     Transcript showCR:t.
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   633
     Transcript showCR:(t subtractMilliseconds:1000).
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   634
    "
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   635
!
ee486429674b pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents: 5968
diff changeset
   636
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   637
subtractMinutes:numberOfMinutes
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   638
    "return a new instance of myself, numberOfMinutes before."
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   639
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   640
    ^ self subtractSeconds:(numberOfMinutes * 60)
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   641
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   642
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   643
     |t|
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   644
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   645
     t := AbsoluteTime now.
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   646
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   647
     Transcript showCR:(t subtractMinutes:60).
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   648
    "
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   649
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   650
    "
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   651
     |t|
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   652
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   653
     t := Time now.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   654
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   655
     Transcript showCR:(t subtractMinutes:60).
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   656
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   657
!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   658
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   659
subtractSeconds:numberOfSeconds
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   660
    "return a new instance of myself, numberOfSeconds before."
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   661
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   662
    ^ self species basicNew 
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   663
        setMilliseconds:(self getMilliseconds - (numberOfSeconds * 1000))
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   664
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   665
    "
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   666
     |t|
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   667
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   668
     t := AbsoluteTime now.
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   669
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   670
     Transcript showCR:(t subtractSeconds:60).
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   671
    "
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   672
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   673
    "
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   674
     |t|
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   675
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   676
     t := Time now.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   677
     Transcript showCR:t.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   678
     Transcript showCR:(t subtractSeconds:60).
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   679
    "
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   680
!
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   681
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   682
subtractTime:timeAmount
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   683
    "return a new instance of myself, timeAmount seconds before myself.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   684
     Provided for ST-80 compatibility.
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   685
     WARNING:
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   686
        SubtractTime is a bad name - it does not add a time, but expects
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   687
        a numberOfSeconds as argument. 
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   688
        Use any of addSeconds/addHours etc. to make things clear"
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   689
3476
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   690
    ^ self subtractSeconds:timeAmount
f2ebb76a952d dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents: 2310
diff changeset
   691
275
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   692
! !
a76029ddaa98 *** empty log message ***
claus
parents: 240
diff changeset
   693
5573
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   694
!AbstractTime methodsFor:'comparing'!
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   695
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   696
< aTime
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   697
    "return true if the receiver is before the argument"
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   698
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   699
    ^ self getMilliseconds < aTime getMilliseconds
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   700
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   701
    "Modified: 3.7.1996 / 13:10:17 / cg"
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   702
!
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   703
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   704
> aTime
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   705
    "return true if the receiver is after the argument"
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   706
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   707
    ^ self getMilliseconds > aTime getMilliseconds
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   708
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   709
    "Modified: 1.7.1996 / 15:24:38 / cg"
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   710
! !
efd0dc6578ac #-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents: 5548
diff changeset
   711
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   712
!AbstractTime methodsFor:'printing & storing'!
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   713
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   714
addPrintBindingsTo:aDictionary
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   715
    "add bindings for printing to aDictionary."
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   716
6172
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   717
    |hours minutes seconds millis usHours ampm s zone tzDelta|
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   718
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   719
    hours := self hours.
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   720
    minutes := self minutes.
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   721
    seconds := self seconds.
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   722
    millis := self milliseconds.
5968
4832ed93f0b4 preps for timeZone
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
   723
    zone := self timeZoneName.
6172
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   724
    tzDelta := self timeZoneDeltaInMinutes.
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   725
6419
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   726
    ampm := self meridianAbbreviation.
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   727
    usHours := self hour12.
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   728
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   729
    aDictionary at:$H put:(s := hours printString).
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   730
    aDictionary at:$h put:(s leftPaddedTo:2 with:$0).
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   731
    aDictionary at:$U put:(s := usHours printString).
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   732
    aDictionary at:$u put:(s leftPaddedTo:2 with:$0).
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   733
    aDictionary at:$M put:(s := minutes printString).
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   734
    aDictionary at:$m put:(s leftPaddedTo:2 with:$0).
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   735
    aDictionary at:$S put:(s := seconds printString).
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   736
    aDictionary at:$s put:(s leftPaddedTo:2 with:$0).
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   737
    aDictionary at:$I put:(s := millis printString).
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   738
    aDictionary at:$i put:(s leftPaddedTo:3 with:$0).
4904
33d322c419ba more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents: 4844
diff changeset
   739
    aDictionary at:#milli1 put:((millis // 100) printString).
33d322c419ba more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents: 4844
diff changeset
   740
    aDictionary at:#milli2 put:((millis // 10) printStringLeftPaddedTo:2 with:$0).
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   741
    aDictionary at:$t put:(seconds * minutes) printString.
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   742
    aDictionary at:$T put:(seconds * minutes * hours) printString.
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   743
    aDictionary at:$a put:ampm.
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   744
    aDictionary at:$A put:ampm asUppercase.
5968
4832ed93f0b4 preps for timeZone
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
   745
    aDictionary at:$z put:zone.
4832ed93f0b4 preps for timeZone
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
   746
    aDictionary at:$Z put:zone asUppercase.
6172
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   747
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   748
    s := tzDelta >= 0 ifTrue:[ '+' ] ifFalse:[ '-' ].
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   749
    tzDelta := tzDelta abs.
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   750
    s := s , ((tzDelta // 60) printStringLeftPaddedTo:2 with:$0).
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   751
    s := s , ':'.
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   752
    s := s , ((tzDelta \\ 60) printStringLeftPaddedTo:2 with:$0).
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   753
    aDictionary at:#TZD put:s
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   754
!
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   755
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   756
printOn:aStream format:aFormatString
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   757
    "print using a format string;
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   758
     valid format items are:
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   759
        %h      hours, 00..23 (i.e. european)  0-padded to length 2
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   760
        %u      hours, 00..12 (i.e. us)        0-padded to length 2
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   761
        %m      minutes, 00..59                0-padded to length 2
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   762
        %s      seconds, 00..59                0-padded to length 2
4841
605413879f65 comment
Claus Gittinger <cg@exept.de>
parents: 4840
diff changeset
   763
        %i      milliseconds, 000..999         0-padded to length 3
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   764
        %a      am/pm
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   765
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   766
     AbsoluteTime only:
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   767
        %day     day, 00..31                    0-padded to length 2
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   768
        %mon     month, 00..12                  0-padded to length 2
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   769
        %yr      year, 4 digits                 0-padded to length 4
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   770
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   771
     special:
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   772
        %H      24-hours - unpadded
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   773
        %U      12-hours - unpadded
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   774
        %M      minutes - unpadded
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   775
        %S      seconds - unpadded
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   776
        %I      milliseconds - unpadded
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   777
        %A      AM/PM   - uppercase
4841
605413879f65 comment
Claus Gittinger <cg@exept.de>
parents: 4840
diff changeset
   778
605413879f65 comment
Claus Gittinger <cg@exept.de>
parents: 4840
diff changeset
   779
        %t      seconds within hour  (unpadded)
605413879f65 comment
Claus Gittinger <cg@exept.de>
parents: 4840
diff changeset
   780
        %T      seconds from midNight  (unpadded)
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   781
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   782
     AbsoluteTime only:
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   783
        %Day    day - unpadded                    
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   784
        %Mon    month - unpadded                    
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   785
    "
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   786
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   787
    aStream nextPutAll:(self printStringFormat:aFormatString)
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   788
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   789
    "
4650
0a8d9f7a38ef More examples
Stefan Vogel <sv@exept.de>
parents: 4649
diff changeset
   790
     AbsoluteTime now printOn:Transcript format:'%h:%m:%s'   . Transcript cr.      
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   791
     Time now printOn:Transcript format:'%h:%m:%s'   . Transcript cr.      
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   792
     Time now printOn:Transcript format:'%H:%m:%s'   . Transcript cr.      
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   793
     Time now printOn:Transcript format:'%u:%m:%s %a'. Transcript cr.   
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   794
     Time now printOn:Transcript format:'%h:%m'      . Transcript cr. 
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   795
     Time now printOn:Transcript format:'%H:%m %A'   . Transcript cr.
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   796
     Time now printOn:Transcript format:'minutes:%M seconds:%S'   . Transcript cr.
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   797
    "
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   798
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   799
    "Modified: 22.2.1996 / 16:58:30 / cg"
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   800
!
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   801
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   802
printStringFormat:aFormatString
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   803
    "print using a format string;
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   804
     valid format items are:
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   805
        %h      hours, 00..23 (i.e. european)  0-padded to length 2
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   806
        %u      hours, 00..12 (i.e. us)        0-padded to length 2
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   807
        %m      minutes, 00..59                0-padded to length 2
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   808
        %s      seconds, 00..59                0-padded to length 2
4840
e97f4f2339d9 added milliseconds in printFormat
Claus Gittinger <cg@exept.de>
parents: 4835
diff changeset
   809
        %i      milliseconds, 000..999         0-padded to length 3
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   810
        %a      am/pm
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   811
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   812
     AbsoluteTime only:
6172
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   813
        %(day)   day, 00..31                    0-padded to length 2
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   814
        %(month) month, 00..12                  0-padded to length 2
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   815
        %(year)  year, 4 digits                 0-padded to length 4
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   816
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   817
     special:
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   818
        %H      24-hours - unpadded
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   819
        %U      12-hours - unpadded
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   820
        %M      minutes - unpadded
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   821
        %S      seconds - unpadded
4840
e97f4f2339d9 added milliseconds in printFormat
Claus Gittinger <cg@exept.de>
parents: 4835
diff changeset
   822
        %I      milliseconds, unpadded
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   823
        %A      AM/PM   - uppercase
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   824
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   825
        %t      seconds within hour  (unpadded)
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   826
        %T      seconds from midNight  (unpadded)
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   827
6172
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   828
        %(TZD)  timeZone delta from UTC in the format +/-hh:mm  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   829
4904
33d322c419ba more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents: 4844
diff changeset
   830
        %milli1 milliseconds, truncated to 1/10th of a second 0..9         
33d322c419ba more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents: 4844
diff changeset
   831
        %milli2 milliseconds, truncated to 1/100th of a second 00..99 0-padded to length 2        
33d322c419ba more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents: 4844
diff changeset
   832
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   833
     AbsoluteTime only:
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   834
        %Day    day - unpadded                    
4929
ac174b74d54e month vs. mon
Claus Gittinger <cg@exept.de>
parents: 4905
diff changeset
   835
        %Month  month - unpadded                    
6172
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   836
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   837
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   838
     The ISO8601 printString are generated with:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   839
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   840
       Year:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   841
          YYYY (eg 1997)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   842
                Date today printStringFormat:'%(year)'
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   843
                AbsoluteTime now printStringFormat:'%(year)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   844
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   845
       Year and month:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   846
          YYYY-MM (eg 1997-07)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   847
                Date today printStringFormat:'%(year)-%(month)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   848
                AbsoluteTime now printStringFormat:'%(year)-%(month)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   849
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   850
       Complete date:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   851
          YYYY-MM-DD (eg 1997-07-16)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   852
                Date today printStringFormat:'%(year)-%(month)-%(day)'    
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   853
                AbsoluteTime now printStringFormat:'%(year)-%(month)-%(day)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   854
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   855
       Complete date plus hours and minutes:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   856
          YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   857
                AbsoluteTime now printStringFormat:'%(year)-%(month)-%(day)T%h:%m%(TZD)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   858
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   859
       Complete date plus hours, minutes and seconds:
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   860
          YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   861
                AbsoluteTime now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s%(TZD)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   862
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   863
       Complete date plus hours, minutes, seconds and a decimal fraction of a second
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   864
          YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   865
                AbsoluteTime now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s.%(milli2)%(TZD)'  
a3c88ea5efe9 comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents: 6048
diff changeset
   866
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   867
    "
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   868
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   869
    |dict|
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   870
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   871
    dict := IdentityDictionary new.
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   872
    self addPrintBindingsTo:dict.
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   873
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   874
    ^ (aFormatString expandPlaceholdersWith:dict)
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   875
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   876
    "
4650
0a8d9f7a38ef More examples
Stefan Vogel <sv@exept.de>
parents: 4649
diff changeset
   877
     AbsoluteTime now printStringFormat:'%U:%m:%s %a'   
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   878
     Time now printStringFormat:'%U:%m:%s %a'   
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   879
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   880
     Time now printStringFormat:'%h:%m:%s'      
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   881
     Time now printStringFormat:'%H:%m:%s'      
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   882
     Time now printStringFormat:'%H:%m:%s.%i'           
4905
a18c448021d2 more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents: 4904
diff changeset
   883
     AbsoluteTime now printStringFormat:'%H:%m:%s.%i'   
4904
33d322c419ba more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents: 4844
diff changeset
   884
     AbsoluteTime now printStringFormat:'%H:%m:%s.%(milli1)'   
33d322c419ba more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents: 4844
diff changeset
   885
     AbsoluteTime now printStringFormat:'%H:%m:%s.%(milli2)'     
5829
0e83511d9549 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
   886
     AbsoluteTime now printStringFormat:'%(day)-%(month)-%(year) :%m:%s'       
0e83511d9549 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
   887
     AbsoluteTime now printStringFormat:'%(day)-%(monthName)-%(year) :%m:%s'       
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   888
     Time now printStringFormat:'%u:%m:%s %a'   
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   889
     Time now printStringFormat:'%h:%m'         
4844
6938f0df31f7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4841
diff changeset
   890
     Time now printStringFormat:'%h:%m'         
4649
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   891
     Time now printStringFormat:'%H:%m %A'     
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   892
     Time now printStringFormat:'%m minutes after %U %a'     
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   893
     Time now printStringFormat:'%t seconds after %U %a'     
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   894
     Time now printStringFormat:'%T seconds from midNight'     
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   895
    "
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   896
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   897
    "Modified: 22.2.1996 / 16:58:30 / cg"
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   898
! !
3eaf75dd8973 Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents: 3476
diff changeset
   899
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   900
!AbstractTime methodsFor:'private'!
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   901
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   902
fromOSTime:osTime
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   903
    "set my time, from operatingSystems time parts"
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   904
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   905
    ^ self subclassResponsibility
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   906
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   907
    "Modified: 1.7.1996 / 15:09:44 / cg"
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   908
!
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   909
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   910
getMilliseconds
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   911
    "get the milliseconds.
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   912
     Since I am abstract (not knowing how the time is actually
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   913
     represented), this must be done by a concrete class."
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   914
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   915
    ^ self subclassResponsibility
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   916
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   917
    "Created: 1.7.1996 / 14:16:49 / cg"
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   918
!
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   919
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   920
getSeconds
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   921
    "get the seconds.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   922
     Since I am abstract (not knowing how the time is actually
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   923
     represented), this must be done by a concrete class."
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   924
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   925
    ^ self subclassResponsibility
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   926
!
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   927
1500
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   928
setMilliseconds:millis
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   929
    "set the milliseconds.
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   930
     Since I am abstract (not knowing how the time is actually
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   931
     represented), this must be done by a concrete class."
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   932
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   933
    ^ self subclassResponsibility
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   934
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   935
    "Created: 1.7.1996 / 14:17:00 / cg"
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   936
!
d42e61e53cee changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   937
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   938
setSeconds:secs
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   939
    "set the seconds.
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   940
     Since I am abstract (not knowing how the time is actually
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   941
     represented), this must be done by a concrete class."
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   942
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   943
    ^ self subclassResponsibility
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   944
! !
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   945
2310
2cb1366e0eb3 Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents: 1500
diff changeset
   946
!AbstractTime class methodsFor:'documentation'!
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   947
699
12f456343eea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   948
version
6419
5cf00f5e656d more ANSI compatibility
Claus Gittinger <cg@exept.de>
parents: 6172
diff changeset
   949
    ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.35 2002-02-26 11:34:25 cg Exp $'
240
f5ff68fffb92 Initial revision
claus
parents:
diff changeset
   950
! !