Changeset 35417 in project


Ignore:
Timestamp:
04/22/18 00:13:31 (5 weeks ago)
Author:
kon
Message:

add 'timezone runtime init ex

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/srfi-19

    r35412 r35417  
    710710<enscript language=scheme>
    711711(require-extension srfi-19)
     712</enscript>
     713
     714
     715== Examples
     716
     717* Prevent default timezone initialization by explicitly setting the 'timezone.
     718
     719<enscript language=scheme>
     720;must be done before 1st invocation of a srfi-19 export
     721(use locale)
     722(set-locale-category! 'timezone
     723  (posix-timezone-string->timezone-components
     724    ;some acceptable posix tz form
     725    "XSX+2:00XDX+1:00:00"
     726    ;source of tz info
     727    '("POSIX" "TZ")))
     728
     729;now we can use srfi-19 in our runtime tz
     730(use srfi-19 extras)
     731(format #t "Present Day: ~A~%Present Time: ~A~%: Hah, hah, hah.~%"
     732  (current-date) (current-time))
    712733</enscript>
    713734
     
    742763
    743764
     765== Bugs and Limitations
     766
     767* Local timezone information is not necessarily valid for historic dates and
     768problematic for future dates. Daylight saving time is especially an issue.
     769Conversion of a time or seconds value to a local date will use the current
     770timezone offset value. The current offset will reflect the daylight saving time
     771status. So target dates outside of the DST period will be converted
     772incorrectly!
     773
     774* Will not read years less than 1 properly. The ISO 8601 year convention for
     775years 1 BCE and before and years 10000 CE and after is not supported.
     776
     777* Cannot swap SRFI 29 bundle. Fixed at load time.
     778
     779* Using {{date-adjust}} for the same {{date-key}} MomentJS says:
     780
     781If you are adding hours, minutes, seconds, or milliseconds, the assumption is
     782that you want precision to the hour, and will result in a different hour.
     783
     784<enscript language=javascript>
     785var m = moment(new Date(2011, 2, 12, 5, 0, 0)); // the day before DST in the US
     786m.hours(); // 5
     787m.add(24, 'hours').hours(); // 6
     788</enscript>
     789
     790but this implementation says 1 day = 24 hours, so same hour.
     791
     792
    744793== Requirements
    745794
     
    750799[[check-errors]]
    751800[[record-variants]]
    752 
    753 
    754 == Bugs and Limitations
    755 
    756 * Local timezone information is not necessarily valid for historic dates and
    757 problematic for future dates. Daylight saving time is especially an issue.
    758 Conversion of a time or seconds value to a local date will use the current
    759 timezone offset value. The current offset will reflect the daylight saving time
    760 status. So target dates outside of the DST period will be converted
    761 incorrectly!
    762 
    763 * Will not read years less than 1 properly. The ISO 8601 year convention for
    764 years 1 BCE and before and years 10000 CE and after is not supported.
    765 
    766 * Cannot swap SRFI 29 bundle. Fixed at load time.
    767 
    768 * Using {{date-adjust}} for the same {{date-key}} MomentJS says:
    769 
    770 If you are adding hours, minutes, seconds, or milliseconds, the assumption is
    771 that you want precision to the hour, and will result in a different hour.
    772 
    773 <enscript language=javascript>
    774 var m = moment(new Date(2011, 2, 12, 5, 0, 0)); // the day before DST in the US
    775 m.hours(); // 5
    776 m.add(24, 'hours').hours(); // 6
    777 </enscript>
    778 
    779 but this implementation says 1 day = 24 hours, so same hour.
    780801
    781802
Note: See TracChangeset for help on using the changeset viewer.