AbstractOperatingSystem.st
changeset 11843 b5bd41fe1e8f
parent 11835 bf65bdad3827
child 11846 77deb8041ea1
equal deleted inserted replaced
11842:43bb5d8495e0 11843:b5bd41fe1e8f
    28 !
    28 !
    29 
    29 
    30 Object subclass:#TimeInfo
    30 Object subclass:#TimeInfo
    31 	instanceVariableNames:'year month day hours minutes seconds utcOffset dst milliseconds
    31 	instanceVariableNames:'year month day hours minutes seconds utcOffset dst milliseconds
    32 		dayInYear dayInWeek'
    32 		dayInYear dayInWeek'
       
    33 	classVariableNames:''
       
    34 	poolDictionaries:''
       
    35 	privateIn:AbstractOperatingSystem
       
    36 !
       
    37 
       
    38 Object subclass:#TimeZoneInfo
       
    39 	instanceVariableNames:'bias name standardYear standardMonth standardDay standardWeekDay
       
    40 		standardHour standardMinute standardBias daylightName
       
    41 		daylightYear daylightMonth daylightDay daylightWeekDay
       
    42 		daylightHour daylightMinute daylightBias'
    33 	classVariableNames:''
    43 	classVariableNames:''
    34 	poolDictionaries:''
    44 	poolDictionaries:''
    35 	privateIn:AbstractOperatingSystem
    45 	privateIn:AbstractOperatingSystem
    36 !
    46 !
    37 
    47 
  6581 
  6591 
  6582      If utcOffset is negative, the local timezone is east of Greenwich.
  6592      If utcOffset is negative, the local timezone is east of Greenwich.
  6583      If utcOffset is positive, the local timezone is west of Greenwich."
  6593      If utcOffset is positive, the local timezone is west of Greenwich."
  6584 
  6594 
  6585     ^ utcOffset
  6595     ^ utcOffset
       
  6596 
       
  6597     "
       
  6598      OperatingSystem utcOffset
       
  6599     "
  6586 !
  6600 !
  6587 
  6601 
  6588 year
  6602 year
  6589     ^ year
  6603     ^ year
  6590 !
  6604 !
  6618     dst := dstArg.
  6632     dst := dstArg.
  6619     dayInYear := dayInYearArg.
  6633     dayInYear := dayInYearArg.
  6620     dayInWeek := dayInWeekArg.
  6634     dayInWeek := dayInWeekArg.
  6621 ! !
  6635 ! !
  6622 
  6636 
       
  6637 !AbstractOperatingSystem::TimeZoneInfo class methodsFor:'documentation'!
       
  6638 
       
  6639 documentation
       
  6640 "
       
  6641 Bias
       
  6642     The current bias for local time translation on this computer, in minutes. 
       
  6643     The bias is the difference, in minutes, between Coordinated Universal Time (UTC) 
       
  6644     and local time. 
       
  6645     All translations between UTC and local time are based on the following formula:
       
  6646 
       
  6647         UTC = local time + bias
       
  6648 
       
  6649 StandardName
       
  6650     A description for standard time. For example, 'EST' could indicate Eastern Standard Time. 
       
  6651     The string will be returned unchanged by the GetTimeZoneInformation function. 
       
  6652     This string can be empty.
       
  6653     This is for information only - do not depend on the value of the string.
       
  6654 
       
  6655 StandardDate
       
  6656     A Timestamp that contains a date and local time when the transition from daylight saving 
       
  6657     time to standard time occurs on this operating system. 
       
  6658     If the time zone does not support daylight saving time or if the caller needs to disable 
       
  6659     daylight saving time, the standardDate is nil.
       
  6660     If this date is specified, the DaylightDate member of this structure must also be specified. 
       
  6661     Otherwise, the system assumes the time zone data is invalid and no changes will be applied.
       
  6662 
       
  6663     To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members 
       
  6664     to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate 
       
  6665     the occurrence of the day of the week within the month (1 to 5, where 5 indicates the final occurrence 
       
  6666     during the month if that day of the week does not occur 5 times).
       
  6667 
       
  6668     Using this notation, specify 02:00 on the first Sunday in April as follows: 
       
  6669         wHour = 2, wMonth = 4, wDayOfWeek = 0, wDay = 1. 
       
  6670     Specify 02:00 on the last Thursday in October as follows: 
       
  6671         wHour = 2, wMonth = 10, wDayOfWeek = 4, wDay = 5.
       
  6672 
       
  6673     If the wYear member is not zero, the transition date is absolute; it will only occur one time. 
       
  6674     Otherwise, it is a relative date that occurs yearly.
       
  6675 
       
  6676 StandardBias
       
  6677     The bias value to be used during local time translations that occur during standard time. 
       
  6678     This member is ignored if a value for the StandardDate member is not supplied.
       
  6679 
       
  6680     This value is added to the value of the Bias member to form the bias used during standard time. 
       
  6681     In most time zones, the value of this member is zero.
       
  6682 
       
  6683 DaylightName
       
  6684     A description for daylight saving time. For example, 'PDT' could indicate Pacific Daylight Time. 
       
  6685     The string will be returned unchanged by the GetTimeZoneInformation function. This string can be empty.
       
  6686     This is for information only - do not depend on the value of the string.
       
  6687 
       
  6688 DaylightDate
       
  6689     A Timestamp structure that contains a date and local time when the transition from standard time 
       
  6690     to daylight saving time occurs on this operating system. 
       
  6691     If the time zone does not support daylight saving time or if the caller needs to disable daylight 
       
  6692     saving time, this entry is nil.
       
  6693     If this date is specified, the StandardDate member in this structure must also be specified. 
       
  6694     Otherwise, the system assumes the time zone data is invalid and no changes will be applied.
       
  6695 
       
  6696     To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to 
       
  6697     the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate 
       
  6698     the occurrence of the day of the week within the month (1 to 5, where 5 indicates the final occurrence 
       
  6699     during the month if that day of the week does not occur 5 times).
       
  6700 
       
  6701     If the wYear member is not zero, the transition date is absolute; it will only occur one time. 
       
  6702     Otherwise, it is a relative date that occurs yearly.
       
  6703 
       
  6704 DaylightBias
       
  6705     The bias value to be used during local time translations that occur during daylight saving time. 
       
  6706     This member is ignored if a value for the DaylightDate member is not supplied.
       
  6707 
       
  6708     This value is added to the value of the Bias member to form the bias used during daylight saving time. 
       
  6709     In most time zones, the value of this member is -60
       
  6710 "
       
  6711 ! !
       
  6712 
       
  6713 !AbstractOperatingSystem::TimeZoneInfo methodsFor:'accessing'!
       
  6714 
       
  6715 bias
       
  6716     ^ bias
       
  6717 !
       
  6718 
       
  6719 bias:something
       
  6720     bias := something.
       
  6721 !
       
  6722 
       
  6723 bias:biasArg name:nameArg standardBias:standardBiasArg daylightName:daylightNameArg daylightBias:daylightBiasArg 
       
  6724     bias := biasArg.
       
  6725     name := nameArg.
       
  6726     standardBias := standardBiasArg.
       
  6727     daylightName := daylightNameArg.
       
  6728     daylightBias := daylightBiasArg.
       
  6729 !
       
  6730 
       
  6731 bias:biasArg name:nameArg standardDate:standardDateArg standardBias:standardBiasArg daylightName:daylightNameArg daylightDate:daylightDateArg daylightBias:daylightBiasArg 
       
  6732     bias := biasArg.
       
  6733     name := nameArg.
       
  6734     standardDate := standardDateArg.
       
  6735     standardBias := standardBiasArg.
       
  6736     daylightName := daylightNameArg.
       
  6737     daylightDate := daylightDateArg.
       
  6738     daylightBias := daylightBiasArg.
       
  6739 !
       
  6740 
       
  6741 daylightBias
       
  6742     ^ daylightBias
       
  6743 !
       
  6744 
       
  6745 daylightBias:something
       
  6746     daylightBias := something.
       
  6747 !
       
  6748 
       
  6749 daylightDay
       
  6750     ^ daylightDay
       
  6751 !
       
  6752 
       
  6753 daylightDay:something
       
  6754     daylightDay := something.
       
  6755 !
       
  6756 
       
  6757 daylightHour
       
  6758     ^ daylightHour
       
  6759 !
       
  6760 
       
  6761 daylightHour:something
       
  6762     daylightHour := something.
       
  6763 !
       
  6764 
       
  6765 daylightMinute
       
  6766     ^ daylightMinute
       
  6767 !
       
  6768 
       
  6769 daylightMinute:something
       
  6770     daylightMinute := something.
       
  6771 !
       
  6772 
       
  6773 daylightMonth
       
  6774     ^ daylightMonth
       
  6775 !
       
  6776 
       
  6777 daylightMonth:something
       
  6778     daylightMonth := something.
       
  6779 !
       
  6780 
       
  6781 daylightName
       
  6782     ^ daylightName
       
  6783 !
       
  6784 
       
  6785 daylightName:something
       
  6786     daylightName := something.
       
  6787 !
       
  6788 
       
  6789 daylightWeekDay
       
  6790     ^ daylightWeekDay
       
  6791 !
       
  6792 
       
  6793 daylightWeekDay:something
       
  6794     daylightWeekDay := something.
       
  6795 !
       
  6796 
       
  6797 daylightYear
       
  6798     ^ daylightYear
       
  6799 !
       
  6800 
       
  6801 daylightYear:something
       
  6802     daylightYear := something.
       
  6803 !
       
  6804 
       
  6805 daylightYear:daylightYearArg daylightMonth:daylightMonthArg daylightDay:daylightDayArg daylightWeekDay:daylightWeekDayArg daylightHour:daylightHourArg daylightMinute:daylightMinuteArg 
       
  6806     daylightYear := daylightYearArg.
       
  6807     daylightMonth := daylightMonthArg.
       
  6808     daylightDay := daylightDayArg.
       
  6809     daylightWeekDay := daylightWeekDayArg.
       
  6810     daylightHour := daylightHourArg.
       
  6811     daylightMinute := daylightMinuteArg.
       
  6812 !
       
  6813 
       
  6814 name
       
  6815     ^ name
       
  6816 !
       
  6817 
       
  6818 name:something
       
  6819     name := something.
       
  6820 !
       
  6821 
       
  6822 standardBias
       
  6823     ^ standardBias
       
  6824 !
       
  6825 
       
  6826 standardBias:something
       
  6827     standardBias := something.
       
  6828 !
       
  6829 
       
  6830 standardDay
       
  6831     ^ standardDay
       
  6832 !
       
  6833 
       
  6834 standardDay:something
       
  6835     standardDay := something.
       
  6836 !
       
  6837 
       
  6838 standardHour
       
  6839     ^ standardHour
       
  6840 !
       
  6841 
       
  6842 standardHour:something
       
  6843     standardHour := something.
       
  6844 !
       
  6845 
       
  6846 standardMinute
       
  6847     ^ standardMinute
       
  6848 !
       
  6849 
       
  6850 standardMinute:something
       
  6851     standardMinute := something.
       
  6852 !
       
  6853 
       
  6854 standardMonth
       
  6855     ^ standardMonth
       
  6856 !
       
  6857 
       
  6858 standardMonth:something
       
  6859     standardMonth := something.
       
  6860 !
       
  6861 
       
  6862 standardWeekDay
       
  6863     ^ standardWeekDay
       
  6864 !
       
  6865 
       
  6866 standardWeekDay:something
       
  6867     standardWeekDay := something.
       
  6868 !
       
  6869 
       
  6870 standardYear
       
  6871     ^ standardYear
       
  6872 !
       
  6873 
       
  6874 standardYear:something
       
  6875     standardYear := something.
       
  6876 !
       
  6877 
       
  6878 standardYear:standardYearArg standardMonth:standardMonthArg standardDay:standardDayArg standardWeekDay:standardWeekDayArg standardHour:standardHourArg standardMinute:standardMinuteArg 
       
  6879     standardYear := standardYearArg.
       
  6880     standardMonth := standardMonthArg.
       
  6881     standardDay := standardDayArg.
       
  6882     standardWeekDay := standardWeekDayArg.
       
  6883     standardHour := standardHourArg.
       
  6884     standardMinute := standardMinuteArg.
       
  6885 ! !
       
  6886 
       
  6887 !AbstractOperatingSystem::TimeZoneInfo methodsFor:'queries'!
       
  6888 
       
  6889 utcOffset
       
  6890     "return the difference between UTC (Greenwich Mean Time) and the local time in seconds.
       
  6891      If daylight saving time applies to ourself, take that into account.
       
  6892      Add utcOffset to convert from local time to UTC time.
       
  6893      Subtract utcOffset to convert from UTC time to local time.
       
  6894 
       
  6895      If utcOffset is negative, the local timezone is east of Greenwich.
       
  6896      If utcOffset is positive, the local timezone is west of Greenwich."
       
  6897 
       
  6898     ^ (bias + daylightBias) * 60
       
  6899 
       
  6900     "
       
  6901      OperatingSystem utcOffset
       
  6902     "
       
  6903 ! !
       
  6904 
  6623 !AbstractOperatingSystem class methodsFor:'documentation'!
  6905 !AbstractOperatingSystem class methodsFor:'documentation'!
  6624 
  6906 
  6625 version
  6907 version
  6626     ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.187 2009-08-05 09:12:24 stefan Exp $'
  6908     ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.188 2009-08-12 13:17:29 cg Exp $'
  6627 ! !
  6909 ! !
  6628 
  6910 
  6629 AbstractOperatingSystem initialize!
  6911 AbstractOperatingSystem initialize!