Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
time
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rinat Striungis
time
Commits
6a437d64
Commit
6a437d64
authored
6 years ago
by
Ashley Yakeley
Browse files
Options
Downloads
Patches
Plain Diff
Clean up documentation
parent
773b8c44
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/Data/Time/Clock/Internal/NominalDiffTime.hs
+3
-1
3 additions, 1 deletion
lib/Data/Time/Clock/Internal/NominalDiffTime.hs
lib/Data/Time/Clock/POSIX.hs
+7
-8
7 additions, 8 deletions
lib/Data/Time/Clock/POSIX.hs
with
10 additions
and
9 deletions
lib/Data/Time/Clock/Internal/NominalDiffTime.hs
+
3
−
1
View file @
6a437d64
...
@@ -16,9 +16,11 @@ import Control.DeepSeq
...
@@ -16,9 +16,11 @@ import Control.DeepSeq
-- | This is a length of time, as measured by UTC.
-- | This is a length of time, as measured by UTC.
-- It has a precision of 10^-12 s.
--
-- Conversion functions will treat it as seconds.
-- Conversion functions will treat it as seconds.
-- For example, @(0.010 :: NominalDiffTime)@ corresponds to 10 milliseconds.
-- For example, @(0.010 :: NominalDiffTime)@ corresponds to 10 milliseconds.
--
It has a precision of 10^-12 s.
--
-- It ignores leap-seconds, so it's not necessarily a fixed amount of clock time.
-- It ignores leap-seconds, so it's not necessarily a fixed amount of clock time.
-- For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day),
-- For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day),
-- regardless of whether a leap-second intervened.
-- regardless of whether a leap-second intervened.
...
...
This diff is collapsed.
Click to expand it.
lib/Data/Time/Clock/POSIX.hs
+
7
−
8
View file @
6a437d64
-- | POSIX time, if you need to deal with timestamps and the like.
-- | POSIX time, if you need to deal with timestamps and the like.
-- Most people won't need this module.
-- Most people won't need this module.
--
--
-- If you want to convert POSIX time to integer/word timestamps,
-- You can use 'POSIXTime' to obtain integer/word timestamps. For example:
-- consider the following example:
--
--
-- > import
Data.Time.Clock (UTCTime, getCurrentTime, nominalDiffTimeToSeconds)
-- > import
Data.Time
-- > import
Data.Time.Clock.POSIX
(utcTimeToPOSIXSeconds)
-- > import Data.Time.Clock.POSIX
-- > import
Data.Int (Int64)
-- > import
Data.Int
-- >
-- >
-- > nanosSinceEpoch :: UTCTime -> Int64
-- > nanosSinceEpoch :: UTCTime -> Int64
-- > nanosSinceEpoch =
-- > nanosSinceEpoch =
-- > floor . (1e9 *) . nominalDiffTimeToSeconds . utcTimeToPOSIXSeconds
-- >
floor . (1e9 *) . nominalDiffTimeToSeconds . utcTimeToPOSIXSeconds
-- >
-- >
-- > main :: IO ()
-- > main :: IO ()
-- > main = do
-- > main = do
-- > u <- getCurrentTime
:: IO UTCTime
-- >
u <- getCurrentTime
-- > print
(
nanosSinceEpoch u
)
-- >
print
$
nanosSinceEpoch u
module
Data.Time.Clock.POSIX
module
Data.Time.Clock.POSIX
(
(
posixDayLength
,
POSIXTime
,
posixSecondsToUTCTime
,
utcTimeToPOSIXSeconds
,
getPOSIXTime
,
getCurrentTime
,
posixDayLength
,
POSIXTime
,
posixSecondsToUTCTime
,
utcTimeToPOSIXSeconds
,
getPOSIXTime
,
getCurrentTime
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment