Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 47 lines (37 sloc) 1.57 kb
3b1d1ac @davazp Move time data type to types-time.lisp
authored
1 ;; types-time.lisp ---
2 ;;
3 ;; Copyrigth (C) 2009, 2010 Mario Castelán Castro <marioxcc>
4 ;; Copyrigth (C) 2009, 2010 David Vázquez
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
c461b40 @davazp Datetime, date and time stands for universal times.
authored
23 ;;; Time
3b1d1ac @davazp Move time data type to types-time.lisp
authored
24
c461b40 @davazp Datetime, date and time stands for universal times.
authored
25 (defconstant +seconds-per-day+ 86400)
3b1d1ac @davazp Move time data type to types-time.lisp
authored
26
c461b40 @davazp Datetime, date and time stands for universal times.
authored
27 (deftype time () `(mod ,+seconds-per-day+))
070999c @davazp save-vcalendar function added for testing and routine to get the
authored
28 (register-ical-value time)
3b1d1ac @davazp Move time data type to types-time.lisp
authored
29
c461b40 @davazp Datetime, date and time stands for universal times.
authored
30 (defun encode-time (hour minute second)
31 (encode-universal-time second minute hour 1 1 1900 0))
3b1d1ac @davazp Move time data type to types-time.lisp
authored
32
c461b40 @davazp Datetime, date and time stands for universal times.
authored
33 (defmethod format-value (time (type (eql 'time)) &optional params)
3b1d1ac @davazp Move time data type to types-time.lisp
authored
34 (declare (ignore params))
c461b40 @davazp Datetime, date and time stands for universal times.
authored
35 (decoded-universal-time (:hour h :minute m :second s) time
36 (format nil "~2,'0d~2,'0d~2,'0d" h m s)))
3b1d1ac @davazp Move time data type to types-time.lisp
authored
37
73c15cf @davazp New parameters.lisp file. This is use to avoid string->symbol
authored
38 (defmethod parse-value (string (type (eql 'time)) &optional params)
c461b40 @davazp Datetime, date and time stands for universal times.
authored
39 (declare (ignore params))
40 (encode-time
41 (parse-unsigned-integer string :start 0 :end 2)
42 (parse-unsigned-integer string :start 2 :end 4)
43 (parse-unsigned-integer string :start 4 :end 6)))
3b1d1ac @davazp Move time data type to types-time.lisp
authored
44
45
46 ;;; types-time.lisp ends here
Something went wrong with that request. Please try again.