Win32OperatingSystem.st
changeset 17042 f381b63198e1
parent 17023 7715cae24e91
child 17117 4a6ee105223e
equal deleted inserted replaced
17041:baed8c1a8aab 17042:f381b63198e1
 10216     "
 10216     "
 10217 
 10217 
 10218     "Modified: / 07-07-2010 / 16:56:56 / cg"
 10218     "Modified: / 07-07-2010 / 16:56:56 / cg"
 10219 !
 10219 !
 10220 
 10220 
 10221 computeTimeAndDateFrom:osTime
       
 10222     "given an OS-dependent time in osTime, return an Array
       
 10223      containing (full-) year, month, day, hour, minute and seconds,
       
 10224      offset to UTC, daylight savings time flag, milliseconds,
       
 10225      dayInYear (1..) and dayInWeek (1..).
       
 10226      Conversion is to localtime including any daylight saving adjustments."
       
 10227 
       
 10228     ^ self timeInfoFromOsTime:osTime localTime:true.
       
 10229 !
       
 10230 
       
 10231 computeUTCTimeAndDateFrom:osTime
       
 10232     "given an OS-dependent time in osTime, return an Array
       
 10233      containing:
       
 10234 	(full-) year,
       
 10235 	month,                          (1..)
       
 10236 	day,                            (1..)
       
 10237 	hour,                           (0..23)
       
 10238 	minute                          (0..59)
       
 10239 	seconds,                        (0..59)
       
 10240 	offset to UTC,                  (seconds)
       
 10241 	daylight savings time flag,
       
 10242 	milliseconds,                   (0..999)
       
 10243 	dayInYear                       (1..)
       
 10244 	dayInWeek                       (1..).
       
 10245      Conversion is to utc."
       
 10246 
       
 10247     ^ self timeInfoFromOsTime:osTime localTime:false.
       
 10248 !
       
 10249 
       
 10250 epochEndOSTime
 10221 epochEndOSTime
 10251     "private interface for timestamp to ask the OS what the maximum time
 10222     "private interface for timestamp to ask the OS what the maximum time
 10252      (in milliseconds since the Unix epoch, 1.1.1970) is.
 10223      (in milliseconds since the Unix epoch, 1.1.1970) is.
 10253      Windows has a 64 Unix 100ns osTime internally, which goes from 0 (1601)
 10224      Windows has a 64 Unix 100ns osTime internally, which goes from 0 (1601)
 10254      to 16r7FFFFFFFFFFFFFFF."
 10225      to 16r7FFFFFFFFFFFFFFF."
 10584     "
 10555     "
 10585      OperatingSystem sleep:2
 10556      OperatingSystem sleep:2
 10586     "
 10557     "
 10587 !
 10558 !
 10588 
 10559 
 10589 timeInfoFromOsTime:osTime localTime:isLocalTime
 10560 timeInfoFromSeconds:osSeconds milliseconds:osMilliSeconds localTime:isLocalTime
 10590     "return a timeInfo structure containing values for the given OS-millisecond value.
 10561     "return a timeInfo structure containing values for the given OS-millisecond value.
 10591      An internal helper"
 10562      An internal helper"
 10592 
 10563 
 10593     |year month day hours minutes seconds millis utcOffset nonDstOffset
 10564     |year month day hours minutes seconds millis utcOffset nonDstOffset
 10594      dst yDay weekDay info reason tLow tHigh t|
 10565      dst yDay weekDay info reason tLow tHigh t|
 10595 
 10566 
 10596     t := osTime + self osTimeOf19700101.
 10567     t := (osSeconds * 1000) + osMilliSeconds + self osTimeOf19700101.
 10597     tLow := (t bitAnd:16rFFFFFFFF).
 10568     tLow := (t bitAnd:16rFFFFFFFF).
 10598     tHigh := t bitShift:-32.
 10569     tHigh := t bitShift:-32.
 10599 
 10570 
 10600 %{
 10571 %{
 10601     FILETIME fileTime;
 10572     FILETIME fileTime;
 17844 ! !
 17815 ! !
 17845 
 17816 
 17846 !Win32OperatingSystem class methodsFor:'documentation'!
 17817 !Win32OperatingSystem class methodsFor:'documentation'!
 17847 
 17818 
 17848 version
 17819 version
 17849     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.513 2014-11-11 10:23:19 stefan Exp $'
 17820     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.514 2014-11-11 16:51:09 cg Exp $'
 17850 !
 17821 !
 17851 
 17822 
 17852 version_CVS
 17823 version_CVS
 17853     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.513 2014-11-11 10:23:19 stefan Exp $'
 17824     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.514 2014-11-11 16:51:09 cg Exp $'
 17854 !
 17825 !
 17855 
 17826 
 17856 version_SVN
 17827 version_SVN
 17857     ^ '$Id: Win32OperatingSystem.st,v 1.513 2014-11-11 10:23:19 stefan Exp $'
 17828     ^ '$Id: Win32OperatingSystem.st,v 1.514 2014-11-11 16:51:09 cg Exp $'
 17858 
 17829 
 17859 ! !
 17830 ! !
 17860 
 17831 
 17861 
 17832 
 17862 Win32OperatingSystem initialize!
 17833 Win32OperatingSystem initialize!