Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Carl Shapiro
cmucl
Commits
10e79065
Commit
10e79065
authored
31 years ago
by
wlott
Browse files
Options
Downloads
Patches
Plain Diff
Fixed to deal with daylight savings time better.
parent
7e3a6be6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/format-time.lisp
+29
-13
29 additions, 13 deletions
code/format-time.lisp
with
29 additions
and
13 deletions
code/format-time.lisp
+
29
−
13
View file @
10e79065
...
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(
ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/format-time.lisp,v 1.
3
199
1/02/08 13:32:55 ram
Exp $"
)
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/format-time.lisp,v 1.
4
199
3/11/13 00:57:30 wlott
Exp $"
)
;;;
;;; **********************************************************************
...
...
@@ -18,7 +18,7 @@
;;; **********************************************************************
(
in-package
"EXTENSIONS"
:use
'
(
"LISP"
)
)
(
in-package
:extensions
)
(
export
'
(
format-universal-time
format-decoded-time
))
...
...
@@ -42,6 +42,9 @@
(
defconstant
timezone-table
'#(
"GMT"
""
""
""
""
"EST"
"CST"
"MST"
"PST"
))
(
defconstant
daylight-table
'#(
nil
nil
nil
nil
nil
"EDT"
"CDT"
"MDT"
"PDT"
))
;;; Valid-Destination-P ensures the destination stream is okay
;;; for the Format function.
...
...
@@ -86,7 +89,7 @@
(
if
timezone
(
decode-universal-time
universal-time
timezone
)
(
decode-universal-time
universal-time
))
(
declare
(
ignore
dst
)
(
fixnum
secs
mins
hours
day
month
year
dow
))
(
declare
(
fixnum
secs
mins
hours
day
month
year
dow
))
(
let
((
time-string
"~2,'0D:~2,'0D"
)
(
date-string
(
case
style
...
...
@@ -133,18 +136,31 @@
(
if
date-first
(
nconc
date-args
(
nreverse
time-args
)
(
if
print-timezone
(
list
(
let
((
which-zone
(
or
timezone
tz
)))
(
if
(
or
(
=
0
which-zone
)
(
<=
5
which-zone
8
))
(
svref
timezone-table
which-zone
)
(
format
nil
"[~D]"
which-zone
))))))
(
list
(
timezone-name
dst
tz
))))
(
nconc
(
nreverse
time-args
)
date-args
(
if
print-timezone
(
list
(
let
((
which-zone
(
or
timezone
tz
)))
(
if
(
or
(
=
0
which-zone
)
(
<
5
which-zone
8
))
(
svref
timezone-table
which-zone
)
(
format
nil
"[~D]"
which-zone
)))))))))))
(
list
(
timezone-name
dst
tz
)))))))))
(
defun
timezone-name
(
dst
tz
)
(
if
(
and
(
integerp
tz
)
(
or
(
and
dst
(
=
tz
0
))
(
<=
5
tz
8
)))
(
svref
(
if
dst
daylight-table
timezone-table
)
tz
)
(
multiple-value-bind
(
rest
seconds
)
(
truncate
(
*
tz
60
60
)
60
)
(
multiple-value-bind
(
hours
minutes
)
(
truncate
rest
60
)
(
format
nil
"[~C~D~@[~*:~2,'0D~@[~*:~2,'0D~]~]]"
(
if
(
minusp
tz
)
#\-
#\+
)
(
abs
hours
)
(
not
(
and
(
zerop
minutes
)
(
zerop
seconds
)))
(
abs
minutes
)
(
not
(
zerop
seconds
))
(
abs
seconds
))))))
;;; Format-Decoded-Time - External.
...
...
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