tzinfo: time zone information for Racket
97jaz / tzinfo Goto Github PK
View Code? Open in Web Editor NEWtzinfo: time zone information for Racket
License: MIT License
tzinfo: time zone information for Racket
License: MIT License
The problem is that the symlink will point at the installed zoneinfo DB, but the zoneinfo dir in use will be from the tzdata package.
Currently, the code insists that the symlink point inside the zoneinfo dir that's actually being used. I should relax that and insist only that a file with the same zoneinfo-relative path exists in the current DB.
If I try to install this package on a Windows machine, using "raco pkg install tzinfo", the installation fails. This happens using both Racket 7.4 and Racket 7.4 CS:
collection-file-path: collection not found
collection: "tzinfo\\private"
in collection directories:
C:\program files\racket\collects
... [170 additional linked and package directories]
It seems that, if I comment out the path list creation in "zoneinfo.rkt", the problem goes away and the package seems to work fine. So the "fix" for me is to do the following:
(define-runtime-path-list tzdata-paths
(match (find-relevant-directories '(tzdata-zoneinfo-dir))
[(cons dir _)
(define relpath ((get-info/full dir) 'tzdata-zoneinfo-dir))
(define zoneinfo-dir (build-path dir relpath))
(current-zoneinfo-search-path (list zoneinfo-dir))
;; (parameterize ([current-directory zoneinfo-dir])
;; (for/list ([f (in-directory)])
;; (list 'lib (path->string (build-path "tzinfo" relpath (path->string f))))))
'()]
[_ '()]))
I am not sure what tzdata-paths
is used for, so I don't think this is the right fix.
This section of the docs:
UNIX systems usually come with a compiled version of the IANA database (typically in /usr/share/zoneinfo). tzinfo will use the system’s database if available. However, if the tzdata package is installed, that will be used instead. Since Windows systems do not come with a zoneinfo database, Windows users must install tzdata to use tzinfo.
...seems to imply that Windows users must explicitly install tzdata
themselves in order to use tzinfo
. But the platform-specific dependency in tzinfo
's info.rkt
file takes care of that automatically. It would be clearer if the docs explicitly specified that Windows users don't need to do any work beyond installing tzinfo
.
It should list the paths that were checked and suggest that the user either:
tzdata
package, which contains the databaseThe message could be somewhat long. It might be better to keep the message short and direct the user to a section of documentation that contains a longer description.
Version 2 tzfiles can end with a POSIX-style time zone descriptor, which is used to describe how to handle instants after the final transition described in the file. This library has never parsed that value and has, instead, just indefinitely extended the final period listed in the file. That seemed to work reasonably well with older files, apparently because the tzdata
build process wrote some number of future transitions, and OS-supplied tzfiles also seem to typically include future transitions. The default build in tzdb now is apparently more parsimonious. (I'd wager that the build can be configured to generate some number of future transitions, and that would be a good temporary workaround.)
For example, in the current files, the last transition listed for America/New_York
is in 2007, because that's the last time DST rules changed in the US. The file ends with:
EST5EDT,M3.2.0,M11.1.0
... meaning that, after the final explicit transition, we should assume annual transitions between UTC-5 and UTC-4 (the 1-hour difference is implicit here), where the transition into DST starts in the 0th day (i.e., Sunday) of the 2nd week of the 3rd month and the transition back is on the 0th day of the 1st week of the 11th month. The times can be specified but, if omitted (as here) are assumed to be 02:00.
The transitions can also be specified by day-of-year (either omitting or not Feb. 29, 'cause that's a great feature), and there are a bunch of other possibilities too.
I'm going to first look into the quick workaround that I mentioned above (though that will apply to the tzdata
package, not this one). Then I'll work on a general fix.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.