The trivial-rfc-1123 Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The trivial-rfc-1123 Reference Manual

This is the trivial-rfc-1123 Reference Manual, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 04:41:21 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

TRIVIAL-RFC-1123

Parses and prints dates in RFC-1123 format. Like this:

CL-USER> (ql:quickload :trivial-rfc-1123)
CL-USER> (t1123:parse-date "Fri, 16 Jul 2010 02:33:50 -0500") ;note 't1132:' abbrev.
3488254430
CL-USER> (t1123:as-rfc-1123 3488254430); default tz is 0, or GMT
"Fri, 16-Jul-2010 07:33:50 GMT"

CL-USER> (t1123:as-rfc-1123 3488254430 :timezone 5); 'cause lisp TZ is backwards
"Fri, 16-Jul-2010 02:33:50 -0500"

CL-USER> (t1123:as-rfc-1123 (get-universal-time) :timezone nil); use current tz!
...


(parse-date string)

Return: universal time for the string.

date-parse-error condition will be raised in case of problems.

(as-rfc-1123 universal-time &key (stream nil) (timezone 0)

Stream:

Timezone:

Return: string if stream is nil, nil otherwise.

License

Parts are subject to "Edi Weitz" license, and the entire surrounding project, a similar BSD 3-clause license. The lowdown: credit copyright ownership to Dr. Edward Weitz and Stacksmith, pack licenses and disclaimers with your code and distributables, and do not use the authors' names without permission for any unreasonable purpose.

History

The code started out in drakma and was shoehorned to be a standalone library for applications requiring minimal date parsing and printing.

According to Drakma authors, the following formats will be parsed:

    Wed, 06-Feb-2008 21:01:38 GMT
    Wed, 06-Feb-08 21:01:38 GMT
    Tue Feb 13 08:00:00 2007 GMT
    Wednesday, 07-February-2027 08:55:23 GMT
    Wed, 07-02-2017 10:34:45 GMT

Note: Drakma is not clear on this, but if a timezone offset is specified, it is always considered to be from GMT. It will accept "PST-02:00", but the result is same as "GMT-02:00", or plain "-02:00".

The following was added to the drakma code, based on empirical studies of NNTP dates:

    Fri, 07-02-2017 10:34:45 +0800   numeric timezone is ok - 4 digits HHMM
    Fri, 07-02-2017 10:34:45 +08:00  colon is ok HH:MM
    07-02-2017 10:34:45 GMT          omitting day is ok
	WEd, 06-Feb-08 21:01:38 GmT      no longer case sensitive

A limited output function was added. For more flexible output (such as better timezone handling), see local-time - which sadly does not parse RFC-1123, but outputs it.

References: RFC-1123 RFC-822 Section 5


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 trivial-rfc-1123

Author

Stacksmith <fpgasm@apple2.x10.mx>

License

Edi Weitz and BSD 3-clause

Description

minimal parsing of rfc-1123 date-time strings

Dependency

cl-ppcre

Source

trivial-rfc-1123.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 trivial-rfc-1123.asd

Location

trivial-rfc-1123.asd

Systems

trivial-rfc-1123 (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 trivial-rfc-1123/package.lisp

Parent

trivial-rfc-1123 (system)

Location

package.lisp

Packages

trivial-rfc-1123


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 trivial-rfc-1123/trivial-rfc-1123.lisp

Dependency

package.lisp (file)

Parent

trivial-rfc-1123 (system)

Location

trivial-rfc-1123.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 trivial-rfc-1123

Source

package.lisp (file)

Nickname

t1123

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: as-rfc-1123 UNIVERSAL-TIME &key STREAM TIMEZONE

format a universal time to string (default) or optional stream, in GMT timezone (unless :timezone option is specified, in Lisp sign-inverted manner. Specifying NIL for timezone will insert machine-local current timezone, which only makes sense for dealing with current time!

Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)

Function: parse-date STRING

Parses a date and returns it as a Lisp universal
time. Currently understands the following formats:

"Wed, 06-Feb-2008 21:01:38 GMT"
"Wed, 06-Feb-08 21:01:38 GMT"
"Tue Feb 13 08:00:00 2007 GMT"
"Wednesday, 07-February-2027 08:55:23 GMT"
"Wed, 07-02-2017 10:34:45 GMT"

Instead of "GMT" time zone abbreviations like "CEST" and UTC offsets like "GMT-01:30" are also allowed.

Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *time-zone-map*

An alist which maps time zone abbreviations to Common Lisp timezones.

Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)

Special Variable: +day-names+
Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)

Special Variable: +month-names+
Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Macros

Macro: when-let (VAR EXPR) &body BODY

Evaluates EXPR, binds it to VAR, and executes BODY if VAR has a true value.

Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Functions

Function: date-parse-error FORMAT-CONTROL &rest FORMAT-ARGUMENTS

Signals an error of type DATE-PARSE-ERROR with the provided format control and arguments.

Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)

Function: interpret-as-month STRING

Tries to interpret STRING as a string denoting a month and returns the corresponding number of the month. Accepts three-letter abbreviations like "Feb" and full month names likes "February". Finally, the function also accepts strings representing integers from one to twelve.

Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)

Function: interpret-as-time-zone STRING

Tries to interpret STRING as a time zone abbreviation which can either be something like "PST" or "GMT" with an offset like "GMT-02:00".

Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)

Function: safe-parse-integer STRING

Like PARSE-INTEGER, but returns NIL instead of signalling an error.

Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Conditions

Condition: date-parse-error ()

Signaled when the date cannot be parsed.

Package

trivial-rfc-1123

Source

trivial-rfc-1123.lisp (file)

Direct superclasses

error (condition)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   T  
Index Entry  Section

F
File, Lisp, trivial-rfc-1123.asd: The trivial-rfc-1123<dot>asd file
File, Lisp, trivial-rfc-1123/package.lisp: The trivial-rfc-1123/package<dot>lisp file
File, Lisp, trivial-rfc-1123/trivial-rfc-1123.lisp: The trivial-rfc-1123/trivial-rfc-1123<dot>lisp file

L
Lisp File, trivial-rfc-1123.asd: The trivial-rfc-1123<dot>asd file
Lisp File, trivial-rfc-1123/package.lisp: The trivial-rfc-1123/package<dot>lisp file
Lisp File, trivial-rfc-1123/trivial-rfc-1123.lisp: The trivial-rfc-1123/trivial-rfc-1123<dot>lisp file

T
trivial-rfc-1123.asd: The trivial-rfc-1123<dot>asd file
trivial-rfc-1123/package.lisp: The trivial-rfc-1123/package<dot>lisp file
trivial-rfc-1123/trivial-rfc-1123.lisp: The trivial-rfc-1123/trivial-rfc-1123<dot>lisp file

Jump to:   F   L   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   A   D   F   I   M   P   S   W  
Index Entry  Section

A
as-rfc-1123: Exported functions

D
date-parse-error: Internal functions

F
Function, as-rfc-1123: Exported functions
Function, date-parse-error: Internal functions
Function, interpret-as-month: Internal functions
Function, interpret-as-time-zone: Internal functions
Function, parse-date: Exported functions
Function, safe-parse-integer: Internal functions

I
interpret-as-month: Internal functions
interpret-as-time-zone: Internal functions

M
Macro, when-let: Internal macros

P
parse-date: Exported functions

S
safe-parse-integer: Internal functions

W
when-let: Internal macros

Jump to:   A   D   F   I   M   P   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *   +  
S  
Index Entry  Section

*
*time-zone-map*: Internal special variables

+
+day-names+: Internal special variables
+month-names+: Internal special variables

S
Special Variable, *time-zone-map*: Internal special variables
Special Variable, +day-names+: Internal special variables
Special Variable, +month-names+: Internal special variables

Jump to:   *   +  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   D   P   S   T  
Index Entry  Section

C
Condition, date-parse-error: Internal conditions

D
date-parse-error: Internal conditions

P
Package, trivial-rfc-1123: The trivial-rfc-1123 package

S
System, trivial-rfc-1123: The trivial-rfc-1123 system

T
trivial-rfc-1123: The trivial-rfc-1123 system
trivial-rfc-1123: The trivial-rfc-1123 package

Jump to:   C   D   P   S   T