Giter VIP home page Giter VIP logo

haskell-tz's People

Contributors

errge avatar igrep avatar klao avatar mpietrzak avatar phadej avatar vmchale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

haskell-tz's Issues

TZ -> TZLabel

Is there way to include the TZLabel with TZ, get the TZLabel from TZ or get a system's TZLabel? Ideally I would to make a program that finds the local TZ and TZLabel, store the TZLabel and then use that TZLabel later to adjust UTCTime.

incompatibility with 'slim` /usr/share/zoneinfo format

On a system with sys-libs/timezone-data-2020b and above timezone tests fail as:

Test suite logged to: dist/test/tz-0.1.3.5-th-test.log
Test suite testsSys: RUNNING...
Main:
  Budapest correct TimeZone: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 65, srcLocStartCol = 13, srcLocEndLine = 65, srcLocEndCol = 48})) (ExpectedButGot Nothing "CET" "CEST")' (after 16 tests):
(used seed 373177944295650250)
  New York correct TimeZone: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 65, srcLocStartCol = 13, srcLocEndLine = 65, srcLocEndCol = 48})) (ExpectedButGot Nothing "EST" "EDT")' (after 8 tests):
(used seed -6698765111005426216)
  Los Angeles correct TimeZone: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 65, srcLocStartCol = 13, srcLocEndLine = 65, srcLocEndCol = 48})) (ExpectedButGot Nothing "PST" "PDT")' (after 5 tests):
(used seed -2318792879736774576)
  Shanghai correct TimeZone: [OK, passed 100 tests]
  Jerusalem correct TimeZone: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 65, srcLocStartCol = 13, srcLocEndLine = 65, srcLocEndCol = 48})) (ExpectedButGot Nothing "IST" "IDT")' (after 49 tests):
(used seed -386169573243891044)
  Antarctica Palmer correct TimeZone: [OK, passed 100 tests]
  Melbourne correct TimeZone: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 65, srcLocStartCol = 13, srcLocEndLine = 65, srcLocEndCol = 48})) (ExpectedButGot Nothing "AEDT" "AEST")' (after 15 tests):
(used seed -1326492299289746028)
  Budapest correct LocalTime: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 92, srcLocStartCol = 13, srcLocEndLine = 92, srcLocEndCol = 76})) (ExpectedButGot Nothing "1996-10-27 02:00:00" "1996-10-27 03:00:00")' (after 62 tests and 14 shrinks):
846378000
(used seed -5776371655142200096)
  New York correct LocalTime: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 92, srcLocStartCol = 13, srcLocEndLine = 92, srcLocEndCol = 76})) (ExpectedButGot Nothing "2009-11-01 01:00:00" "2009-11-01 02:00:00")' (after 84 tests and 22 shrinks):
1257055200
(used seed 206784595925771598)
  Los Angeles correct LocalTime: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 92, srcLocStartCol = 13, srcLocEndLine = 92, srcLocEndCol = 76})) (ExpectedButGot Nothing "2008-11-02 01:00:00" "2008-11-02 02:00:00")' (after 86 tests and 12 shrinks):
1225616400
(used seed 2558864323799544892)
  Shanghai correct LocalTime: [OK, passed 100 tests]
  Jerusalem correct LocalTime: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 92, srcLocStartCol = 13, srcLocEndLine = 92, srcLocEndCol = 76})) (ExpectedButGot Nothing "2013-10-27 01:00:00" "2013-10-27 02:00:00")' (after 65 tests and 13 shrinks):
1382828400
(used seed -3609122477262445018)
  Antarctica Palmer correct LocalTime: [OK, passed 100 tests]
  Melbourne correct LocalTime: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 92, srcLocStartCol = 13, srcLocEndLine = 92, srcLocEndCol = 76})) (ExpectedButGot Nothing "2008-10-05 03:00:00" "2008-10-05 02:00:00")' (after 69 tests and 17 shrinks):
1223136000
(used seed 1551956221667884141)

         Properties   Total
 Passed  4            4
 Failed  10           10
 Total   14           14
Test suite testsSys: FAIL

Derive instances

Add Typeable, Data and Generic instances for TZ and other public types.

Support time-1.9

The bounds currently defined for the time dependency do not allow time-1.9. I've tested tz against time-1.9.3 and it compiles just fine and passes all the tests.

Support template-haskell 2.17

First off, I have been enjoying this library, thank you very much for working on it.

I had one minor issue though: GHC 9 comes with template-haskell 2.17 which this library disallows. It would be nice if the dependency bound was bumped to allow version 2.17.

Known workaround: One can disable the template-haskell flag, which then also removes the dependency.

Thank you for the patience.

bindings-posix unbuildable on osx and windows

There are very few use cases (tzset and localtime_r), so the bindings-posix dependency can be dropped. I can do a PR if this is ok.

(obviously right solution would be to fix bindings-posix, but that's a way longer path)

Have `tzdata` depend on `tz`

This package looks like a decent start, but perhaps it would make more sense to have tzdata depend on tz instead of the other way around, as it is now. That way, it's easy to avoid tzdata if you would prefer to use the system timezone files.

Test failure with tzdata 0.2.20201016.0

Test suite tests: RUNNING...
Main:
  utcTZ is utc: [OK]
  utcTZ zero diff: [OK]
  DB utc is utc: [OK]
  Budapest LocalToUTC: [Failed]
expected: LTUUnique {_ltuResult = 2014-03-22 23:15:15.15 UTC, _ltuZone = CET}
 but got: LTUUnique {_ltuResult = 2014-03-22 22:15:15.15 UTC, _ltuZone = CEST}
  Moscow LocalToUTC: [OK]
  UTC diffForAbbr: [OK]
  Paris diffForAbbr: [OK]

         Test Cases  Total
 Passed  6           6
 Failed  1           1
 Total   7           7
Test suite tests: FAIL

Tests fail on x86_64-darwin

Tests succeed for aarch64-linux and x86_64-linux with TZDIR set to the same package output as in this build:

Preprocessing test suite 'tests' for tz-0.1.3.5..
Building test suite 'tests' for tz-0.1.3.5..
[1 of 1] Compiling Main             ( tests/testTZ.hs, dist/build/tests/tests-tmp/Main.o, dist/build/tests/tests-tmp/Main.dyn_o )
Linking dist/build/tests/tests ...
Preprocessing test suite 'th-test' for tz-0.1.3.5..
Building test suite 'th-test' for tz-0.1.3.5..
[1 of 1] Compiling Main             ( tests/testTH.hs, dist/build/th-test/th-test-tmp/Main.o, dist/build/th-test/th-test-tmp/Main.dyn_o )
Linking dist/build/th-test/th-test ...
Preprocessing test suite 'test-all' for tz-0.1.3.5..
Building test suite 'test-all' for tz-0.1.3.5..
[1 of 1] Compiling Main             ( tests/testAll.hs, dist/build/test-all/test-all-tmp/Main.o, dist/build/test-all/test-all-tmp/Main.dyn_o )
Linking dist/build/test-all/test-all ...
Preprocessing test suite 'testsSys' for tz-0.1.3.5..
Building test suite 'testsSys' for tz-0.1.3.5..
[1 of 1] Compiling Main             ( tests/testTZSys.hs, dist/build/testsSys/testsSys-tmp/Main.o, dist/build/testsSys/testsSys-tmp/Main.dyn_o )
ld: warning: /nix/store/3833z5d0n3b57fhyiswa9zqjfig0v1mn-libiconv-50/lib/libiconv.dylib, ignoring unexpected dylib file
ld: warning: /nix/store/3833z5d0n3b57fhyiswa9zqjfig0v1mn-libiconv-50/lib/libiconv.dylib, ignoring unexpected dylib file
Linking dist/build/testsSys/testsSys ...
running tests
Running 4 test suites...
Test suite tests: RUNNING...
Test suite tests: PASS
Test suite logged to: dist/test/tz-0.1.3.5-tests.log
Test suite th-test: RUNNING...
Test suite th-test: PASS
Test suite logged to: dist/test/tz-0.1.3.5-th-test.log
Test suite test-all: RUNNING...
Test suite test-all: PASS
Test suite logged to: dist/test/tz-0.1.3.5-test-all.log
Test suite testsSys: RUNNING...
Main:
  Budapest correct TimeZone: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 65, srcLocStartCol = 13, srcLocEndLine = 65, srcLocEndCol = 48})) (ExpectedButGot Nothing "CEST" "CET")' (after 88 tests):
(used seed -5926020771038564925)
  New York correct TimeZone: [OK, passed 100 tests]
  Los Angeles correct TimeZone: [OK, passed 100 tests]
  Shanghai correct TimeZone: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 65, srcLocStartCol = 13, srcLocEndLine = 65, srcLocEndCol = 48})) (ExpectedButGot Nothing "CST" "CDT")' (after 35 tests):
(used seed 3689723971695505946)
  Jerusalem correct TimeZone: [OK, passed 100 tests]
  Antarctica Palmer correct TimeZone: [OK, passed 100 tests]
  Melbourne correct TimeZone: [OK, passed 100 tests]
  Budapest correct LocalTime: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 92, srcLocStartCol = 13, srcLocEndLine = 92, srcLocEndCol = 76})) (ExpectedButGot Nothing "1920-09-20 01:59:59" "1920-09-20 02:59:59")' (after 94 tests and 11 shrinks):
-1555196401
(used seed -8399082595569329368)
  New York correct LocalTime: [OK, passed 100 tests]
  Los Angeles correct LocalTime: [OK, passed 100 tests]
  Shanghai correct LocalTime: [OK, passed 100 tests]
  Jerusalem correct LocalTime: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "tests/testTZSys.hs", srcLocStartLine = 92, srcLocStartCol = 13, srcLocEndLine = 92, srcLocEndCol = 76})) (ExpectedButGot Nothing "1984-05-06 00:00:00" "1984-05-06 01:00:00")' (after 59 tests and 15 shrinks):
452642400
(used seed -3267593269727769404)
  Antarctica Palmer correct LocalTime: [OK, passed 100 tests]
  Melbourne correct LocalTime: [OK, passed 100 tests]

         Properties   Total       
 Passed  10           10          
 Failed  4            4           
 Total   14           14          
Test suite testsSys: FAIL
Test suite logged to: dist/test/tz-0.1.3.5-testsSys.log
3 of 4 test suites (3 of 4 test cases) passed.

loadTZFromDB and loadSystemTZ differ

If I change loadSystemTZ to loadTZFromDB in setupTZ in testTZ, the checkTimeZone64 tests start to fail at least on mac os x. checkTimeZone seem to be ok. Any idea why?

  Melbourne correct TimeZone: [Failed]
*** Failed! Exception: 'HUnitFailure (Just (Location {locationFile = "tests/testTZ.hs", locationLine = 78, locationColumn = 13})) "expected: CET\n but got: LMT"' (after 63 tests): 

is my mac local locale information invalid?

Bump dependencies to fit into Stackage.

Hi,

Would you be able to adjust your version bounds so that your package can be listed on stackage? The problematic versions are listed here:

commercialhaskell/stackage#907

Also, if you are willing to list yourself as the package maintainer for tz on the stackage listing, this would make it possible for your dependencies (like my dixi package) to be on stackage also.

Strange results with Australia/Brisbane and Asia/Dubai

At https://github.com/glasserc/weird-tzs I have pushed a test program that demonstrates a strange behavior that we saw in production. It takes the date 2015-11-23 midnight in Brisbane and converts it to UTC. On my machine, its output is:

$ cabal run
Preprocessing executable 'weird-tzs' for weird-tzs-0.1.0.0...
Local time:
2015-11-23 00:00:00
reading date is 2015-08-25 12:37:52 UTC

Compare with the output if you change Brisbane to Sydney:

$ ./dist/build/weird-tzs/weird-tzs
Local time:
2015-11-23 00:00:00
reading date is 2015-11-22 13:00:00 UTC

Certain timezones seem to be affected by this. Asia/Dubai is and Asia/Singapore is, but Asia/Baku isn't.

Interestingly, running the same code in the repl behaves correctly:

$ cabal repl Main.hs 
Warning: Ignoring 'Main.hs. The whole executable 'weird-tzs' will be built.
(Support for module and file targets has not been implemented yet.)
[...]
[1 of 1] Compiling Main             ( Main.hs, interpreted )
Ok, modules loaded: Main.
*Main> main
Local time:
2015-11-23 00:00:00
reading date is 2015-11-22 14:00:00 UTC
*Main> 

Any idea what's going on? This showed up after we switched from tzdata + timezone-series to tzdata + tz.

utcToZonedTimeTZ please?

Hello,

Thanks for sharing haskell-tz.

Just want to check if you might be interested in providing utcToZonedTimeTZ similar to utcToLocalTimeTZ.

Thanks

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.