UtcTimestamp.st
author Jan Vrany <jan.vrany@labware.com>
Tue, 01 Jun 2021 12:09:10 +0100
branchjv
changeset 25423 bcfde4da086a
parent 23547 c69c97cec351
permissions -rw-r--r--
Cherry-picked `AbstractTime.st`, `Time`, `TimeDuration`, `Timestamp` `TZTimestamp` and `UtcTimestamp` ...from branch default (eXept's code): cherry-picked AbstractTime.st from a6b6dda4caff: * d722454f36b8: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * e3865533e6a6: Merge, HG Automerge * 74daa1537978: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 26521b634779: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * d402bce6f0c4: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * bb2ede52a8f0: #REFACTORING by cg, Claus Gittinger <cg@exept.de> * 3edefecbb6b6: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 96964b12a929: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 89f954dcc609: #FEATURE by cg, Claus Gittinger <cg@exept.de> * df853ecc851b: #BUGFIX by mawalch, mawalch * ec2526db594c: #REFACTORING by cg, Claus Gittinger <cg@exept.de> * 1c878b36a068: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 5e61e62bd48a: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * dfdd78f1f144: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 3c29351e939e: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * c74635278990: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 9748ba089af4: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * c6f530d70280: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 46b7e5b5dc48: #REFACTORING by stefan, Stefan Vogel <sv@exept.de> * cf5b68a4bca7: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 5c413c4c1188: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 40173e082cbc: Copyright updates, Jan Vrany <jan.vrany@fit.cvut.cz> * acf3d6e991aa: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * fcf3d6f2f944: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * c1a02a758d28: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 27a335bed151: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 8227a9ce831d: #FEATURE by stefan, Stefan Vogel <sv@exept.de> * 26cadc041af2: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 77992734168a: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 8862e0666d1f: #OTHER by exept, Claus Gittinger <cg@exept.de> cherry-picked Time.st from a6b6dda4caff: * 5e9eceb76859: #REFACTORING by cg, Claus Gittinger <cg@exept.de> * fb6c49f010a1: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 89897abfad56: #FEATURE by cg, Claus Gittinger <cg@exept.de> * ff149d1b48fb: #FEATURE by cg, Claus Gittinger <cg@exept.de> * a303a0c8a8c9: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 84cc05d2dde8: #OTHER by cg, Claus Gittinger <cg@exept.de> * 46fd19ee3446: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * 72c9d0ab725d: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 42e8ecc961bc: #REFACTORING by cg, Claus Gittinger <cg@exept.de> * 02d39aaca894: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 4fcb818b33a1: #FEATURE by cg, Claus Gittinger <cg@exept.de> cherry-picked TimeDuration.st from a6b6dda4caff: * c4de48f134d1: #OTHER by cg, Claus Gittinger <cg@exept.de> * 32dccde0a4b9: #DOCUMENTATION by stefan, Stefan Vogel <sv@exept.de> * 61bb613eeb72: #DOCUMENTATION by mawalch, mawalch * 337bf1ed4246: #OTHER by mawalch, mawalch * 4f0593d4b67c: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * cd9916b88990: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 0009fa786578: #REFACTORING by cg, Claus Gittinger <cg@exept.de> * 4f96d547b1ca: #DOCUMENTATION by stefan, Stefan Vogel <sv@exept.de> * e7b51a58d9b4: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * e6aaf78f69d6: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 196d6c806fae: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * b67c6cd14b84: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 0232ebe18eb8: #DOCUMENTATION by stefan, Stefan Vogel <sv@exept.de> * 040b32959a91: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * c77e738e5d23: #FEATURE by cg, Claus Gittinger <cg@exept.de> * ea38224ef388: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * c329c0b27248: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 168193740976: #BUGFIX by mawalch, mawalch * 0e20c1d8ac01: corrected invalid parsing of sub-seconds if not exactly 3 digits were following., Claus Gittinger <cg@exept.de> * 65a92285bb30: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * d6201034cacd: #FEATURE by cg, Claus Gittinger <cg@exept.de> * e8a1e761cdcd: fix stc compiler error, Stefan Vogel <sv@exept.de> * d3675e380987: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 7b475b237f26: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 5a2c1731a17b: #REFACTORING by cg, Claus Gittinger <cg@exept.de> * 7764618c5649: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 8139ede8f0cb: #FEATURE by cg, Claus Gittinger <cg@exept.de> * ea25b6e2cdae: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * ed881ba3a4d2: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 77d1d90b53bc: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 43f44339eee0: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * b8cf1f0e0e65: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * c629e025c96b: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 4ed210df350c: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * ac18d6513ef8: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * cefccd43b35a: #FEATURE by cg, Claus Gittinger <cg@exept.de> * ed09bf19e476: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 8a5a2399ea28: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 4efa84e493a9: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * 1c2629bf2cac: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * c3ceaec4f180: #DOCUMENTATION by stefan, Stefan Vogel <sv@exept.de> * 0070f1889bc6: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * b6fdc6aabf3f: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * 322b5ee4229b: #FEATURE by stefan, Stefan Vogel <sv@exept.de> * 58d2044ec761: #FEATURE by cg, Claus Gittinger <cg@exept.de> * f3f05b723a29: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * b0e21078359c: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 758ae1a35ecb: #DOCUMENTATION by exept, Claus Gittinger <cg@exept.de> * 0d393e57e171: #FEATURE by exept, Claus Gittinger <cg@exept.de> * 6fe4d0ddbfa2: #TUNING by stefan, Stefan Vogel <sv@exept.de> * 7453e1747201: #REFACTORING by exept, Claus Gittinger <cg@exept.de> * 373cc0ac5f71: #BUGFIX by exept, Claus Gittinger <cg@exept.de> * 0dacbf3f67d7: #BUGFIX by exept, Claus Gittinger <cg@exept.de> * 3ef66bb4ec5a: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * 943b883a1eca: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 7c114737905e: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 228341544321: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 520cd37ab4e0: #FEATURE by exept, Claus Gittinger <cg@exept.de> cherry-picked Timestamp.st from a6b6dda4caff: * c2cb27ae6231: #REFACTORING by stefan, Stefan Vogel <sv@exept.de> * b8eea1f574cf: #OTHER by mawalch, mawalch * 1f634836c816: #OTHER by mawalch, mawalch * dba489905fcc: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 349664f7c110: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 9a707f3b74c2: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 875197e3bb08: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 369da8fe40ea: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 2b4c63a427fb: #FEATURE by cg, Claus Gittinger <cg@exept.de> * e7112f73582e: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 9ea9757226e5: #REFACTORING by cg, Claus Gittinger <cg@exept.de> * a70e3ac5710e: #FEATURE by cg, Claus Gittinger <cg@exept.de> * c8ab3b3ad654: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 7069c0491453: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * c09377000ff0: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 434085ae9420: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * cc5d5daffdfa: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 9617f4a45cdb: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 0401fecb9c89: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 81be3c10fb6c: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 1bb3760b2967: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 663fa103b1e9: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 92a205803803: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 80d58e6fcf9f: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 9bd6b9704250: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * f43fb9a64745: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * 0833f0a1e701: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * d93aefb6e389: #BUGFIX by cg, Claus Gittinger <cg@exept.de> * d04302832bfb: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * c69c97cec351: Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present, Patrik Svestka <patrik.svestka@gmail.com> * 82d98769fd95: #DOCUMENTATION by stefan, Stefan Vogel <sv@exept.de> * cf0cf0b4de18: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 28bca8eff682: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 8ab5e2adcf65: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 93d4db241317: #FEATURE by cg, Claus Gittinger <cg@exept.de> * b50d5ba0d03b: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 0681f4ab2d53: #FEATURE by alkurz, alkurz * 435fc9fbc45e: #FEATURE by exept, Claus Gittinger <cg@exept.de> * e347fb41b7d7: #TUNING by stefan, Stefan Vogel <sv@exept.de> * 8048f0088a90: #TUNING by stefan, Stefan Vogel <sv@exept.de> * 9ec224d47bc0: #OTHER by exept, Claus Gittinger <cg@exept.de> * b6b8db23fd8f: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 649bf0f4bf49: #DOCUMENTATION by exept, Claus Gittinger <cg@exept.de> cherry-picked TZTimestamp.st from a6b6dda4caff: * faa5502c4f9f: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * aaf413123349: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 8398b8003a8e: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 0fc6b6027916: #FEATURE by cg, Claus Gittinger <cg@exept.de> * c69c97cec351: Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present, Patrik Svestka <patrik.svestka@gmail.com> * a75b5edab98a: #DOCUMENTATION by cg, Claus Gittinger <cg@exept.de> * 1ba2822c99b7: #OTHER by exept, Claus Gittinger <cg@exept.de> cherry-picked UtcTimestamp.st from a6b6dda4caff: * 66ed1ac009dd: #FEATURE by cg, Claus Gittinger <cg@exept.de> * c69c97cec351: Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present, Patrik Svestka <patrik.svestka@gmail.com> * db329a9b7d8d: #OTHER by exept, Claus Gittinger <cg@exept.de>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     1
"
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2011 by eXept Software AG
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     4
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    10
 hereby transferred.
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    11
"
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libbasic' }"
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    13
18452
5724547da8de class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 17130
diff changeset
    14
"{ NameSpace: Smalltalk }"
5724547da8de class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 17130
diff changeset
    15
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    16
Timestamp subclass:#UtcTimestamp
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    20
	category:'Magnitude-Time'
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    21
!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    22
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    23
!UtcTimestamp class methodsFor:'documentation'!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    24
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    25
copyright
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    26
"
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    27
 COPYRIGHT (c) 2011 by eXept Software AG
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    28
              All Rights Reserved
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    29
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    35
 hereby transferred.
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    36
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    37
"
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    38
!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    39
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    40
documentation
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    41
"
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    42
    This is a Timestamp, that represents itself as UTC.
13231
e222e6c577ff changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 13227
diff changeset
    43
    Internally it stores exactly the same value as Timestamp, 
15828
1564a3c784fa class: UtcTimestamp
Stefan Vogel <sv@exept.de>
parents: 13794
diff changeset
    44
    so the following expression is always true:
13231
e222e6c577ff changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 13227
diff changeset
    45
e222e6c577ff changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 13227
diff changeset
    46
        someTimestamp asUtcTimestamp = someTimestamp asLocalTimestamp
e222e6c577ff changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 13227
diff changeset
    47
e222e6c577ff changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 13227
diff changeset
    48
    But when printing, accessing hour, minute, ... and converting to Date and Time,
e222e6c577ff changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 13227
diff changeset
    49
    it returns the values represented in the UTC zone instead of the local timezone.
17130
de560263e67f class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 17051
diff changeset
    50
    Be aware that this may lead to interesting results; for example when converting a timestamp
de560263e67f class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 17051
diff changeset
    51
    to a date, you may get a different date from an UTCTimestamp and a local timestamp.
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    52
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    53
    [author:]
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    54
        Stefan Vogel (stefan@zwerg.nil.exept.de)
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    55
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    56
    [instance variables:]
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    57
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    58
    [class variables:]
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    59
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    60
    [see also:]
13231
e222e6c577ff changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 13227
diff changeset
    61
        Time Date
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    62
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    63
"
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    64
! !
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    65
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    66
!UtcTimestamp methodsFor:'accessing'!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    67
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    68
timeInfo
16979
a793015c75f4 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16969
diff changeset
    69
    ^ self utcTimeInfo
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    70
!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    71
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    72
timeZoneName
16987
1c3e57adcf34 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16979
diff changeset
    73
    ^ 'UTC'
16969
e5da107ac771 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16931
diff changeset
    74
!
e5da107ac771 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16931
diff changeset
    75
e5da107ac771 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16931
diff changeset
    76
utcOffset
18452
5724547da8de class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 17130
diff changeset
    77
    "I am an UTC timestamp, so there is no offset"
5724547da8de class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 17130
diff changeset
    78
    
16969
e5da107ac771 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16931
diff changeset
    79
    ^ 0
17032
e2c097d59814 class: UtcTimestamp
Stefan Vogel <sv@exept.de>
parents: 17028
diff changeset
    80
!
e2c097d59814 class: UtcTimestamp
Stefan Vogel <sv@exept.de>
parents: 17028
diff changeset
    81
e2c097d59814 class: UtcTimestamp
Stefan Vogel <sv@exept.de>
parents: 17028
diff changeset
    82
utcOffsetWithoutDst
e2c097d59814 class: UtcTimestamp
Stefan Vogel <sv@exept.de>
parents: 17028
diff changeset
    83
    ^ 0
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    84
! !
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    85
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    86
!UtcTimestamp methodsFor:'converting'!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    87
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    88
asLocalTimestamp
13232
23a5fb2c645f comment/format in: #asUtcTimestamp
Stefan Vogel <sv@exept.de>
parents: 13231
diff changeset
    89
    "represent myself as a timestamp in the local timezone"
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    90
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    91
    ^ Timestamp fromOSTime:osTime
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    92
!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    93
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    94
asUtcTimestamp
13232
23a5fb2c645f comment/format in: #asUtcTimestamp
Stefan Vogel <sv@exept.de>
parents: 13231
diff changeset
    95
    "I am an UtcTimestamp"
23a5fb2c645f comment/format in: #asUtcTimestamp
Stefan Vogel <sv@exept.de>
parents: 13231
diff changeset
    96
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    97
    ^ self
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    98
! !
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    99
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   100
!UtcTimestamp methodsFor:'initialization'!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   101
16931
c62ad93254c2 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16715
diff changeset
   102
setOSTimeFromYear:y month:m day:d hour:h minute:min second:s millisecond:millis 
16987
1c3e57adcf34 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16979
diff changeset
   103
    "private: ask the operating system to compute the internal osTime (based on the epoch),
1c3e57adcf34 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16979
diff changeset
   104
     given y,m,d and h,m,s in utc time"
1c3e57adcf34 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16979
diff changeset
   105
16997
f0867a7f248b class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16987
diff changeset
   106
   self setOSTimeFromUTCYear:y month:m day:d hour:h minute:min second:s millisecond:millis
13794
600bc500741b changed: #year:month:day:hour:minute:second:millisecond:
Claus Gittinger <cg@exept.de>
parents: 13232
diff changeset
   107
600bc500741b changed: #year:month:day:hour:minute:second:millisecond:
Claus Gittinger <cg@exept.de>
parents: 13232
diff changeset
   108
    "
16997
f0867a7f248b class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16987
diff changeset
   109
     UtcTimestamp now            
f0867a7f248b class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16987
diff changeset
   110
     Timestamp now              
f0867a7f248b class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16987
diff changeset
   111
     Timestamp now asTZTimestamp             
f0867a7f248b class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16987
diff changeset
   112
     Timestamp now asUtcTimestamp  
13794
600bc500741b changed: #year:month:day:hour:minute:second:millisecond:
Claus Gittinger <cg@exept.de>
parents: 13232
diff changeset
   113
    "
600bc500741b changed: #year:month:day:hour:minute:second:millisecond:
Claus Gittinger <cg@exept.de>
parents: 13232
diff changeset
   114
600bc500741b changed: #year:month:day:hour:minute:second:millisecond:
Claus Gittinger <cg@exept.de>
parents: 13232
diff changeset
   115
    "Modified (comment): / 13-10-2011 / 22:05:41 / cg"
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   116
! !
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   117
17051
060104d927c0 class: UtcTimestamp
ca
parents: 17032
diff changeset
   118
!UtcTimestamp methodsFor:'private'!
060104d927c0 class: UtcTimestamp
ca
parents: 17032
diff changeset
   119
060104d927c0 class: UtcTimestamp
ca
parents: 17032
diff changeset
   120
storeStringClass
25423
bcfde4da086a Cherry-picked `AbstractTime.st`, `Time`, `TimeDuration`, `Timestamp` `TZTimestamp` and `UtcTimestamp`
Jan Vrany <jan.vrany@labware.com>
parents: 23547
diff changeset
   121
    "my storeString will ask Timestamp to read the instance"
bcfde4da086a Cherry-picked `AbstractTime.st`, `Time`, `TimeDuration`, `Timestamp` `TZTimestamp` and `UtcTimestamp`
Jan Vrany <jan.vrany@labware.com>
parents: 23547
diff changeset
   122
17051
060104d927c0 class: UtcTimestamp
ca
parents: 17032
diff changeset
   123
    ^ Timestamp
060104d927c0 class: UtcTimestamp
ca
parents: 17032
diff changeset
   124
! !
060104d927c0 class: UtcTimestamp
ca
parents: 17032
diff changeset
   125
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   126
!UtcTimestamp methodsFor:'testing'!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   127
16969
e5da107ac771 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16931
diff changeset
   128
isLocalTimestamp
25423
bcfde4da086a Cherry-picked `AbstractTime.st`, `Time`, `TimeDuration`, `Timestamp` `TZTimestamp` and `UtcTimestamp`
Jan Vrany <jan.vrany@labware.com>
parents: 23547
diff changeset
   129
    "return true, if I am a local timestamp (i.e. with no TZ info)"
16987
1c3e57adcf34 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16979
diff changeset
   130
16969
e5da107ac771 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16931
diff changeset
   131
    ^ false
25423
bcfde4da086a Cherry-picked `AbstractTime.st`, `Time`, `TimeDuration`, `Timestamp` `TZTimestamp` and `UtcTimestamp`
Jan Vrany <jan.vrany@labware.com>
parents: 23547
diff changeset
   132
bcfde4da086a Cherry-picked `AbstractTime.st`, `Time`, `TimeDuration`, `Timestamp` `TZTimestamp` and `UtcTimestamp`
Jan Vrany <jan.vrany@labware.com>
parents: 23547
diff changeset
   133
    "Modified (comment): / 24-05-2018 / 17:29:35 / Claus Gittinger"
16969
e5da107ac771 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16931
diff changeset
   134
!
e5da107ac771 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16931
diff changeset
   135
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   136
isUtcTimestamp
16987
1c3e57adcf34 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16979
diff changeset
   137
    "return true, if I am a utc timestamp"
1c3e57adcf34 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16979
diff changeset
   138
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   139
    ^ true
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   140
! !
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   141
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   142
!UtcTimestamp methodsFor:'visiting'!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   143
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   144
acceptVisitor:aVisitor with:aParameter
16715
5528600b6497 comment/format only
Claus Gittinger <cg@exept.de>
parents: 15828
diff changeset
   145
    "dispatch for visitor pattern; send #visitUtcTimestamp:with: to aVisitor."
5528600b6497 comment/format only
Claus Gittinger <cg@exept.de>
parents: 15828
diff changeset
   146
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   147
    ^ aVisitor visitUtcTimestamp:self with:aParameter
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   148
! !
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   149
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   150
!UtcTimestamp class methodsFor:'documentation'!
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   151
16987
1c3e57adcf34 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16979
diff changeset
   152
version
25423
bcfde4da086a Cherry-picked `AbstractTime.st`, `Time`, `TimeDuration`, `Timestamp` `TZTimestamp` and `UtcTimestamp`
Jan Vrany <jan.vrany@labware.com>
parents: 23547
diff changeset
   153
    ^ '$Header$'
16987
1c3e57adcf34 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16979
diff changeset
   154
!
1c3e57adcf34 class: UtcTimestamp
Claus Gittinger <cg@exept.de>
parents: 16979
diff changeset
   155
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   156
version_CVS
25423
bcfde4da086a Cherry-picked `AbstractTime.st`, `Time`, `TimeDuration`, `Timestamp` `TZTimestamp` and `UtcTimestamp`
Jan Vrany <jan.vrany@labware.com>
parents: 23547
diff changeset
   157
    ^ '$Header$'
13227
0dac835b156e initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   158
! !
15828
1564a3c784fa class: UtcTimestamp
Stefan Vogel <sv@exept.de>
parents: 13794
diff changeset
   159