Git Product home page Git Product logo

tzinfo's Introduction

tzinfo

tzinfo: time zone information for Racket

tzinfo's People

Contributors

97jaz avatar djholtby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tzinfo's Issues

tzid-from-/etc/localtime doesn't work if you're using tzdata and the file's a symlink

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.

Failure to install the package on Windows

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.

Clarify in the docs that tzdata is installed automatically for Windows users

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.

Raise an easy-to-decipher exception if the the tz database cannot be found

It should list the paths that were checked and suggest that the user either:

  • file a bug report, if the system does have the database, and we just weren't able to find it
  • install the appropriate OS package that contains the tz database
  • install the Racket tzdata package, which contains the database

The 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.

[BUG] Parse and use POSIX-style TZ when it occurs at the end of a tzfile

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.