Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,323
    • Issues 4,323
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 373
    • Merge Requests 373
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #2930

Closed
Open
Opened Jan 09, 2009 by wferi@trac-wferi

System.Time.formatCalendarTime: %s isn't the number of seconds since the Epoch

formatCalendarTime references strftime(3), and man strftime says that %s is "the number of seconds since the Epoch, that is, since 1970-01-01 00:00:00 UTC." However, under GHC 6.8.2 it is restricted to the 00-59 range, as the following demonstrates.

epoch.hs is the following:

import System.Time
main = putStrLn $ formatCalendarTime undefined "%Y-%m-%d %T (%s)" (toUTCTime $ TOD 62 0)

And now:

$ runghc epoch.hs 
1970-01-01 00:01:02 (02)
$ date --utc -d @62 +"%Y-%m-%d %T (%s)"
1970-01-01 00:01:02 (62)

I think GNU date is right, System.Time is wrong.

Trac metadata
Trac field Value
Version 6.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/old-time
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
6.10.2
Milestone
6.10.2
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#2930