Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

  1. Outdated egg!
  2. internet-timestamp
    1. Description
    2. Timestamp record type
    3. Library Procedures
      1. Parsing procedures
      2. Formatting procedures
    4. Requires
    5. Version History
    6. License



The internet-timestamp library contains a procedure for parsing of Internet timestamps RFC 3339. It is intended to conform closely to the ABNF grammar in the RFC.

See also rfc3339.

Timestamp record type

 (define-record-type ts 
   (make-ts date time offset) ;; constructor
   ts?  ;; predicate
   (date ts-date )  ;; accessors
   (time ts-time )
   (offset ts-offset )

The internet-timestamp library also defines a record printer for the above record type, which prints timestamp entries in the format specified by the RFC.

Library Procedures

Parsing procedures

The parsing procedures of this library are provided as fields of the <InetTimestamp> typeclass. Please see the typeclass library for information on type classes.

The <InetTimestamp> typeclass is intended to provide abstraction over different kinds of input sequences, e.g. character lists, strings, streams, etc. <InetTimestamp> inherits from <CoreABNF>, which provides the core parsing primitives used to build the timestamp parser (see the abnf library for more information).

The following example illustrates the creation of an instance of <InetTimestamp> specialized for character lists.

(require-extension typeclass internet-timestamp)

(require-library abnf)
(import (only abnf <CoreABNF> 
	       <Input> <Token> <CharLex> 
	      Input->Token Token->CharLex make-<Input>

(define char-list-<Input>
  (make-<Input> null? car cdr))

(define char-list-<Token>
  (Input->Token char-list-<Input>))

(define char-list-<CharLex>
  (Token->CharLex char-list-<Token>))

(define char-list-<CoreABNF>
  (CharLex->CoreABNF char-list-<CharLex>))

(define char-list-<InetTimestamp>
  (CoreABNF->InetTimestamp char-list-<CoreABNF> ))

(define parser (parser char-list-<InetTimestamp>))
[procedure] (parser <InetTimestamp) => (LAMBDA TEXT) => TS

Once applied to an instance of the InetTimestamp typeclass, parser returns a procedure that parses Internet timestamp text and returns a record of type ts.

Formatting procedures

[procedure] (ts->list TS) => LIST

Returns an alist representation of a timestamp:

 ((date (YEAR MONTH DAY)) (time (HOUR MINUTE SECOND FRAC)) (offset (OFFSET)))


Version History


 Copyright 2009-2011 Ivan Raikov.
 This program is free software: you can redistribute it and/or
 modify it under the terms of the GNU General Public License as
 published by the Free Software Foundation, either version 3 of the
 License, or (at your option) any later version.
 This program is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of
 General Public License for more details.
 A full copy of the GPL license can be found at