GithubHelp home page GithubHelp logo

unix-time test fails about stackage HOT 10 CLOSED

byorgey avatar byorgey commented on September 24, 2024
unix-time test fails

from stackage.

Comments (10)

snoyberg avatar snoyberg commented on September 24, 2024

@kazu-yamamoto Any ideas? Should I add unix-time back to the expected failures list?

from stackage.

kazu-yamamoto avatar kazu-yamamoto commented on September 24, 2024

@byorgey Would you do the following sequence?

% cd tests
% ghci UnixTimeSpec.hs
> let ut = UnixTime {utSeconds = 1571502693, utMicroSeconds = 548856}
> formatUnixTime mailDateFormat ut
"Sun, 20 Oct 2019 01:31:33 +0900"
> currentTimeZone <- getCurrentTimeZone
> formatMailModel (toUTCTime ut) currentTimeZone
"Sun, 20 Oct 2019 01:31:33 +0900"

And please tell me what kinds of results are returned.
In the case above, the results are the same. So, it should pass the test.

from stackage.

byorgey avatar byorgey commented on September 24, 2024
*UnixTimeSpec> let ut = UnixTime {utSeconds = 1571502693, utMicroSeconds = 548856}
*UnixTimeSpec> formatUnixTime mailDateFormat ut
"Sat, 19 Oct 2019 12:31:33 -0400"
*UnixTimeSpec> currentTimeZone <- getCurrentTimeZone
*UnixTimeSpec> formatMailModel (toUTCTime ut) currentTimeZone
"Sat, 19 Oct 2019 11:31:33 -0500"

from stackage.

kazu-yamamoto avatar kazu-yamamoto commented on September 24, 2024

Which time zone is correct?

from stackage.

byorgey avatar byorgey commented on September 24, 2024

Oh, I see the problem. On 19 Oct 2019, Daylight Saving Time would be in effect, hence the correct time zone would be -0400 (EDT). However, currently DST is not in effect so the time zone is -0500 (EST). The time zone is date-dependent, hence it is not correct to use currentTimeZone with arbitrary dates.

from stackage.

kazu-yamamoto avatar kazu-yamamoto commented on September 24, 2024

So, what would you suggest to solve this problem? What can I do for this?

from stackage.

byorgey avatar byorgey commented on September 24, 2024

The only way I know of to solve this in a completely correct way would be to use http://hackage.haskell.org/package/timezone-series and http://hackage.haskell.org/package/timezone-olson . However, that involves pulling two more packages into stackage and in any case Olson files may not even be available on every platform. I don't know if it is worth it.

from stackage.

kazu-yamamoto avatar kazu-yamamoto commented on September 24, 2024

@snoyberg Would you add unix-time to the expected failures list?

from stackage.

snoyberg avatar snoyberg commented on September 24, 2024

@kazu-yamamoto Done

from stackage.

snoyberg avatar snoyberg commented on September 24, 2024

OK, since the unix-time test failures no longer affect Stackage, I'm closing this issue. If something in unix-time still needs to be tweaked (I'm not sure based on the above conversation), let's move discussion to unix-time itself.

from stackage.

Related Issues (20)

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.