Skip to content

Commit 208858a

Browse files
committed
(minor) dates and time: formatting
1 parent 6dc2298 commit 208858a

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

dates_and_times.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ computer's CPU. We will deal with both of them separately.
1212

1313
Universal time is represented as the number of seconds that have elapsed since
1414
00:00 of January 1, 1900 in the GMT time zone. The function
15-
[`GET-UNIVERSAL-TIME`](http://www.lispworks.com/documentation/HyperSpec/Body/f_get_un.htm)
15+
[`get-universal-time`](http://www.lispworks.com/documentation/HyperSpec/Body/f_get_un.htm)
1616
returns the current universal time:
1717

1818
~~~lisp
@@ -21,7 +21,7 @@ CL-USER> (get-universal-time)
2121
~~~
2222

2323
Of course this value is not very readable, so you can use the function
24-
[`DECODE-UNIVERSAL-TIME`](http://www.lispworks.com/documentation/HyperSpec/Body/f_dec_un.htm)
24+
[`decode-universal-time`](http://www.lispworks.com/documentation/HyperSpec/Body/f_dec_un.htm)
2525
to turn it into a "calendar time" representation:
2626

2727
~~~lisp
@@ -37,16 +37,20 @@ NIL
3737
5
3838
~~~
3939

40-
This call returns nine values: seconds, minutes, hours, day, month, year, day of
41-
the week, daylight savings time flag and time zone. Note that the day of the
40+
**NB**: in the next section we'll use the `local-time` library to get more user-friendy functions, such as `(local-time:universal-to-timestamp (get-universal-time))` which returns `@2021-06-25T09:16:29.000000+02:00`.
41+
42+
This call to `decode-universal-time` returns nine values: `seconds, minutes, hours, day, month, year, day of
43+
the week, daylight savings time flag and time zone`. Note that the day of the
4244
week is represented as an integer in the range 0..6 with 0 being Monday and 6
43-
being Sunday. Also, the time zone is represented as the number of hours you need
44-
to add to the current time in order to get GMT time. So in this example the
45-
decoded time would be 19:22:06 of Friday, January 25, 2002, in the EST time
45+
being Sunday. Also, the **time zone** is represented as the number of hours you need
46+
to add to the current time in order to get GMT time.
47+
48+
So in this example the
49+
decoded time would be `19:22:06 of Friday, January 25, 2002`, in the EST time
4650
zone, with no daylight savings in effect. This, of course, relies on the
4751
computer's own clock, so make sure that it is set correctly (including the time
4852
zone you are in and the DST flag). As a shortcut, you can use
49-
[`GET-DECODED-TIME`](http://www.lispworks.com/documentation/HyperSpec/Body/f_get_un.htm)
53+
[`get-decoded-time`](http://www.lispworks.com/documentation/HyperSpec/Body/f_get_un.htm)
5054
to get the calendar time representation of the current time directly:
5155

5256
~~~lisp
@@ -83,10 +87,10 @@ CL-USER> (multiple-value-bind
8387
It is now 17:07:17 of Saturday, 1/26/2002 (GMT-5)
8488
~~~
8589

86-
Of course the call to `GET-DECODED-TIME` above could be replaced by
87-
`(DECODE-UNIVERSAL-TIME n)`, where n is any integer number, to print an
90+
Of course the call to `get-decoded-time` above could be replaced by
91+
`(decode-universal-time n)`, where n is any integer number, to print an
8892
arbitrary date. You can also go the other way around: the function
89-
[`ENCODE-UNIVERSAL-TIME`](http://www.lispworks.com/documentation/HyperSpec/Body/f_encode.htm)
93+
[`encode-universal-time`](http://www.lispworks.com/documentation/HyperSpec/Body/f_encode.htm)
9094
lets you encode a calendar time into the corresponding universal time. This
9195
function takes six mandatory arguments (seconds, minutes, hours, day, month and
9296
year) and one optional argument (the time zone) and it returns a universal time:

0 commit comments

Comments
 (0)