AbstractOperatingSystem.st
changeset 7739 d09af69f0466
parent 7733 f556d689cf53
child 7770 9b54b69d4a21
equal deleted inserted replaced
7738:d08da93d4a5f 7739:d09af69f0466
  4762      Conversion is to localtime including any daylight saving adjustments."
  4762      Conversion is to localtime including any daylight saving adjustments."
  4763 
  4763 
  4764     |divMod ret|
  4764     |divMod ret|
  4765 
  4765 
  4766     divMod := osTime divMod:1000.
  4766     divMod := osTime divMod:1000.
  4767     ret := self timeInfoFromSeconds:(divMod at:1) localTime:true.
  4767     ret := self timeInfoFromSeconds:(divMod at:1) milliseconds:(divMod at:2) localTime:true.
  4768     ret milliseconds:(divMod at:2).
       
  4769     ^ ret
  4768     ^ ret
  4770 
  4769 
  4771     "
  4770     "
  4772      OperatingSystem computeTimeAndDateFrom:0
  4771      OperatingSystem computeTimeAndDateFrom:0
  4773      OperatingSystem computeTimeAndDateFrom:1011
  4772      OperatingSystem computeTimeAndDateFrom:1011
  4799      Conversion is to utc."
  4798      Conversion is to utc."
  4800 
  4799 
  4801     |divMod ret|
  4800     |divMod ret|
  4802 
  4801 
  4803     divMod := osTime divMod:1000.
  4802     divMod := osTime divMod:1000.
  4804     ret := self timeInfoFromSeconds:(divMod at:1) localTime:false.
  4803     ret := self timeInfoFromSeconds:(divMod at:1) milliseconds:(divMod at:2) localTime:false.
  4805     ret milliseconds:(divMod at:2).
       
  4806     ^ ret
  4804     ^ ret
  4807 
  4805 
  4808     "
  4806     "
  4809      OperatingSystem computeUTCTimeAndDateFrom:0     
  4807      OperatingSystem computeUTCTimeAndDateFrom:0     
  4810      OperatingSystem computeUTCTimeAndDateFrom:1011
  4808      OperatingSystem computeUTCTimeAndDateFrom:1011
  4998 
  4996 
  4999 timeInfoFromSeconds:osSeconds localTime:isLocalTime
  4997 timeInfoFromSeconds:osSeconds localTime:isLocalTime
  5000     "return a timeInfo structure containing values for the given OS-second value.
  4998     "return a timeInfo structure containing values for the given OS-second value.
  5001      An internal helper"
  4999      An internal helper"
  5002 
  5000 
       
  5001     ^ self timeInfoFromSeconds:osSeconds milliseconds:0 localTime:isLocalTime
       
  5002 !
       
  5003 
       
  5004 timeInfoFromSeconds:osSeconds milliseconds:osMilliSeconds localTime:isLocalTime
       
  5005     "return a timeInfo structure containing values for the given OS-second value.
       
  5006      An internal helper"
       
  5007 
  5003     self subclassResponsibility
  5008     self subclassResponsibility
  5004 ! !
  5009 ! !
  5005 
  5010 
  5006 !AbstractOperatingSystem class methodsFor:'users & groups'!
  5011 !AbstractOperatingSystem class methodsFor:'users & groups'!
  5007 
  5012 
  5371 
  5376 
  5372 at:index
  5377 at:index
  5373     "backward compatibility"
  5378     "backward compatibility"
  5374 
  5379 
  5375     self obsoleteMethodWarning:'use accessor for index ', index printString.
  5380     self obsoleteMethodWarning:'use accessor for index ', index printString.
       
  5381 
  5376     index == 1 ifTrue:[
  5382     index == 1 ifTrue:[
  5377 	^ self year.
  5383         ^ self year.
  5378     ].
  5384     ].
  5379     index == 2 ifTrue:[
  5385     index == 2 ifTrue:[
  5380 	^ self month.
  5386         ^ self month.
  5381     ].
  5387     ].
  5382     index == 3 ifTrue:[
  5388     index == 3 ifTrue:[
  5383 	^ self day.
  5389         ^ self day.
  5384     ].
  5390     ].
  5385     index == 4 ifTrue:[
  5391     index == 4 ifTrue:[
  5386 	^ self hours.
  5392         ^ self hours.
  5387     ].
  5393     ].
  5388     index == 5 ifTrue:[
  5394     index == 5 ifTrue:[
  5389 	^ self minutes.
  5395         ^ self minutes.
  5390     ].
  5396     ].
  5391     index == 6 ifTrue:[
  5397     index == 6 ifTrue:[
  5392 	^ self seconds.
  5398         ^ self seconds.
  5393     ].
  5399     ].
  5394     index == 7 ifTrue:[
  5400     index == 7 ifTrue:[
  5395 	^ self utcOffset.
  5401         ^ self utcOffset.
  5396     ].
  5402     ].
  5397     index == 8 ifTrue:[
  5403     index == 8 ifTrue:[
  5398 	^ self dst.
  5404         ^ self dst.
  5399     ].
  5405     ].
  5400     index == 9 ifTrue:[
  5406     index == 9 ifTrue:[
  5401 	^ self milliseconds.
  5407         ^ self milliseconds.
  5402     ].
  5408     ].
  5403     index == 10 ifTrue:[
  5409     index == 10 ifTrue:[
  5404 	^ self dayInYear.
  5410         ^ self dayInYear.
  5405     ].
  5411     ].
  5406     index == 11 ifTrue:[
  5412     index == 11 ifTrue:[
  5407 	^ self dayInWeek.
  5413         ^ self dayInWeek.
  5408     ].
  5414     ].
  5409     self subscriptBoundsError:index
  5415     self subscriptBoundsError:index
  5410 !
  5416 !
  5411 
  5417 
  5412 day
  5418 day
  5453     ^ utcOffset
  5459     ^ utcOffset
  5454 !
  5460 !
  5455 
  5461 
  5456 year
  5462 year
  5457     ^ year
  5463     ^ year
       
  5464 !
       
  5465 
       
  5466 year:yearArg month:monthArg day:dayArg hours:hoursArg minutes:minutesArg seconds:secondsArg milliseconds:millisecondsArg utcOffset:utcOffsetArg dst:dstArg dayInYear:dayInYearArg dayInWeek:dayInWeekArg 
       
  5467     "set instance variables (automatically generated)"
       
  5468 
       
  5469     year := yearArg.
       
  5470     month := monthArg.
       
  5471     day := dayArg.
       
  5472     hours := hoursArg.
       
  5473     minutes := minutesArg.
       
  5474     seconds := secondsArg.
       
  5475     milliseconds := millisecondsArg.
       
  5476     utcOffset := utcOffsetArg.
       
  5477     dst := dstArg.
       
  5478     dayInYear := dayInYearArg.
       
  5479     dayInWeek := dayInWeekArg.
  5458 !
  5480 !
  5459 
  5481 
  5460 year:yearArg month:monthArg day:dayArg hours:hoursArg minutes:minutesArg seconds:secondsArg utcOffset:utcOffsetArg dst:dstArg dayInYear:dayInYearArg dayInWeek:dayInWeekArg 
  5482 year:yearArg month:monthArg day:dayArg hours:hoursArg minutes:minutesArg seconds:secondsArg utcOffset:utcOffsetArg dst:dstArg dayInYear:dayInYearArg dayInWeek:dayInWeekArg 
  5461     "set instance variables (automatically generated)"
  5483     "set instance variables (automatically generated)"
  5462 
  5484 
  5473 ! !
  5495 ! !
  5474 
  5496 
  5475 !AbstractOperatingSystem class methodsFor:'documentation'!
  5497 !AbstractOperatingSystem class methodsFor:'documentation'!
  5476 
  5498 
  5477 version
  5499 version
  5478     ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.115 2003-11-03 16:40:41 stefan Exp $'
  5500     ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.116 2003-11-10 13:27:59 cg Exp $'
  5479 ! !
  5501 ! !
  5480 
  5502 
  5481 AbstractOperatingSystem initialize!
  5503 AbstractOperatingSystem initialize!