Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 52 lines (44 sloc) 1.9 kb
d71698ed »
2010-06-11 - Move datatime data to types-datetime.lisp
1 ;; types-datetime.lisp ---
2 ;;
3 ;; Copyrigth (C) 2009, 2010 Mario Castelán Castro <marioxcc>
c461b40f »
2011-12-27 Datetime, date and time stands for universal times.
4 ;; Copyrigth (C) 2009, 2010, 2011 David Vázquez
d71698ed »
2010-06-11 - Move datatime data to types-datetime.lisp
5 ;;
6 ;; This file is part of cl-icalendar.
7 ;;
8 ;; cl-icalendar is free software: you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
12 ;;
13 ;; cl-icalendar is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
17 ;;
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with cl-icalendar. If not, see <http://www.gnu.org/licenses/>.
20
21 (in-package :cl-icalendar)
22
c461b40f »
2011-12-27 Datetime, date and time stands for universal times.
23 ;;; Datetimes
d71698ed »
2010-06-11 - Move datatime data to types-datetime.lisp
24
c461b40f »
2011-12-27 Datetime, date and time stands for universal times.
25 (deftype datetime () '(integer 0))
070999cf »
2010-09-20 save-vcalendar function added for testing and routine to get the
26 (register-ical-value datetime :name "DATE-TIME")
d71698ed »
2010-06-11 - Move datatime data to types-datetime.lisp
27
c461b40f »
2011-12-27 Datetime, date and time stands for universal times.
28 (defun encode-datetime (day month year hour minute second)
29 (+ (encode-date day month year)
30 (encode-time hour minute second)))
d71698ed »
2010-06-11 - Move datatime data to types-datetime.lisp
31
c461b40f »
2011-12-27 Datetime, date and time stands for universal times.
32 (defmethod format-value (datetime (type (eql 'datetime)) &optional params)
d71698ed »
2010-06-11 - Move datatime data to types-datetime.lisp
33 (declare (ignore params))
c461b40f »
2011-12-27 Datetime, date and time stands for universal times.
34 (decoded-universal-time (:year y :month m :date d :hour h :minute min :second s)
35 datetime
36 (format nil "~4,'0d~2,'0d~2,'0dT~2,'0d~2,'0d~2,'0d" y m d h min s)))
d71698ed »
2010-06-11 - Move datatime data to types-datetime.lisp
37
73c15cf0 »
2010-08-24 New parameters.lisp file. This is use to avoid string->symbol
38 (defmethod parse-value (string (type (eql 'datetime)) &optional params)
d71698ed »
2010-06-11 - Move datatime data to types-datetime.lisp
39 (declare (ignore params))
40 (flet ((ill-formed () (%parse-error "Bad datetime format.")))
41 (when (< (length string) 9)
42 (ill-formed))
c461b40f »
2011-12-27 Datetime, date and time stands for universal times.
43 (let ((string-date (subseq string 0 8))
d71698ed »
2010-06-11 - Move datatime data to types-datetime.lisp
44 (string-time (subseq string 9)))
45 (unless (char= (elt string 8) #\T)
46 (ill-formed))
47 (let ((date (parse-value string-date 'date))
48 (time (parse-value string-time 'time)))
c461b40f »
2011-12-27 Datetime, date and time stands for universal times.
49 (+ date time)))))
50
d71698ed »
2010-06-11 - Move datatime data to types-datetime.lisp
51
52 ;;; types-datetime.lisp ends here
Something went wrong with that request. Please try again.