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
9bb3723f
Commit
9bb3723f
authored
6 years ago
by
Ashley Yakeley
Browse files
Options
Downloads
Patches
Plain Diff
Documentation about Read/Show instances of TimeZone (#28)
parent
00094ad2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/Data/Time/Format/Locale.hs
+1
-1
1 addition, 1 deletion
lib/Data/Time/Format/Locale.hs
lib/Data/Time/Format/Parse.hs
+6
-0
6 additions, 0 deletions
lib/Data/Time/Format/Parse.hs
lib/Data/Time/LocalTime/Internal/TimeZone.hs
+1
-0
1 addition, 0 deletions
lib/Data/Time/LocalTime/Internal/TimeZone.hs
with
8 additions
and
1 deletion
lib/Data/Time/Format/Locale.hs
+
1
−
1
View file @
9bb3723f
...
...
@@ -32,7 +32,7 @@ data TimeLocale = TimeLocale {
--
-- 'knownTimeZones' contains only the ten time-zones mentioned in RFC 822 sec. 5:
-- \"UT\", \"GMT\", \"EST\", \"EDT\", \"CST\", \"CDT\", \"MST\", \"MDT\", \"PST\", \"PDT\".
-- Note that the parsing functions will regardless parse "UTC", single-letter military time-zones, and +HHMM format.
-- Note that the parsing functions will regardless parse
\
"UTC
\
", single-letter military time-zones, and +HHMM format.
defaultTimeLocale
::
TimeLocale
defaultTimeLocale
=
TimeLocale
{
wDays
=
[(
"Sunday"
,
"Sun"
),
(
"Monday"
,
"Mon"
),
...
...
This diff is collapsed.
Click to expand it.
lib/Data/Time/Format/Parse.hs
+
6
−
0
View file @
9bb3723f
...
...
@@ -157,9 +157,15 @@ instance Read TimeOfDay where
instance
Read
LocalTime
where
readsPrec
_
=
readParen
False
$
readSTime
True
defaultTimeLocale
"%Y-%m-%d %H:%M:%S%Q"
-- | This only works for @±HHMM@ format,
-- single-letter military time-zones,
-- and these time-zones: \"UTC\", \"UT\", \"GMT\", \"EST\", \"EDT\", \"CST\", \"CDT\", \"MST\", \"MDT\", \"PST\", \"PDT\".
instance
Read
TimeZone
where
readsPrec
_
=
readParen
False
$
readSTime
True
defaultTimeLocale
"%Z"
-- | This only works for a 'zonedTimeZone' in @±HHMM@ format,
-- single-letter military time-zones,
-- and these time-zones: \"UTC\", \"UT\", \"GMT\", \"EST\", \"EDT\", \"CST\", \"CDT\", \"MST\", \"MDT\", \"PST\", \"PDT\".
instance
Read
ZonedTime
where
readsPrec
n
=
readParen
False
$
\
s
->
[(
ZonedTime
t
z
,
r2
)
|
(
t
,
r1
)
<-
readsPrec
n
s
,
(
z
,
r2
)
<-
readsPrec
n
r1
]
...
...
This diff is collapsed.
Click to expand it.
lib/Data/Time/LocalTime/Internal/TimeZone.hs
+
1
−
0
View file @
9bb3723f
...
...
@@ -67,6 +67,7 @@ timeZoneOffsetString' (Just c) = timeZoneOffsetString'' False $ Pad 4 c
timeZoneOffsetString
::
TimeZone
->
String
timeZoneOffsetString
=
timeZoneOffsetString''
False
(
Pad
4
'0'
)
-- | This only shows the time zone name, or offset if the name is empty.
instance
Show
TimeZone
where
show
zone
@
(
TimeZone
_
_
""
)
=
timeZoneOffsetString
zone
show
(
TimeZone
_
_
name
)
=
name
...
...
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