comparison lisp/hyperbole/htz.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents 376386a54a3c
children 131b0175ea99
comparison
equal deleted inserted replaced
23:0edd3412f124 24:4103f0995bd7
4 ;; SUMMARY: Timezone-based time and date support for Hyperbole. 4 ;; SUMMARY: Timezone-based time and date support for Hyperbole.
5 ;; USAGE: GNU Emacs Lisp Library 5 ;; USAGE: GNU Emacs Lisp Library
6 ;; KEYWORDS: calendar, hypermedia 6 ;; KEYWORDS: calendar, hypermedia
7 ;; 7 ;;
8 ;; AUTHOR: Masanobu UMEDA / Bob Weiner 8 ;; AUTHOR: Masanobu UMEDA / Bob Weiner
9 ;; ORG: Fujitsu Laboratories LTD. / Brown U. 9 ;; ORG: Fujitsu Laboratories LTD. / InfoDock Associates
10 ;; 10 ;;
11 ;; ORIG-DATE: 14-Oct-91 at 07:22:08 11 ;; ORIG-DATE: 14-Oct-91 at 07:22:08
12 ;; LAST-MOD: 7-Jul-95 at 14:59:51 by Bob Weiner 12 ;; LAST-MOD: 20-Feb-97 at 12:21:10 by Bob Weiner
13 ;; 13 ;;
14 ;; This file is part of Hyperbole. 14 ;; This file is part of Hyperbole.
15 ;; Available for use and distribution under the same terms as GNU Emacs. 15 ;; Available for use and distribution under the same terms as GNU Emacs.
16 ;; 16 ;;
17 ;; Copyright (C) 1991-1995, Free Software Foundation, Inc. 17 ;; Copyright (C) 1991-1995, 1997 Free Software Foundation, Inc.
18 ;; Developed with support from Motorola Inc. 18 ;; Developed with support from Motorola Inc.
19 ;; 19 ;;
20 ;; Adapted from Timezone package for GNU Emacs 20 ;; Adapted from Timezone package for GNU Emacs
21 ;; Copyright(C) 1990 Masanobu UMEDA (umerin@mse.kyutech.ac.jp) 21 ;; Copyright(C) 1990 Masanobu UMEDA (umerin@mse.kyutech.ac.jp)
22 ;; $Header: /afs/informatik.uni-tuebingen.de/local/web/xemacs/xemacs-cvs/XEmacs/xemacs-19/lisp/hyperbole/htz.el,v 1.1.1.1 1996/12/18 03:34:11 steve Exp $ 22 ;; $Header: /afs/informatik.uni-tuebingen.de/local/web/xemacs/xemacs-cvs/XEmacs/xemacs-19/lisp/hyperbole/htz.el,v 1.2 1997/02/22 22:07:18 steve Exp $
23 ;; 23 ;;
24 ;; DESCRIPTION: 24 ;; DESCRIPTION:
25 ;; 25 ;;
26 ;; All date parsing functions accept the output of any other parsing 26 ;; All date parsing functions accept the output of any other parsing
27 ;; function as input, so one can convert to a sortable date format, do a 27 ;; function as input, so one can convert to a sortable date format, do a
70 timezone))) 70 timezone)))
71 71
72 (defun htz:date-parse (date &optional parsed-current-date) 72 (defun htz:date-parse (date &optional parsed-current-date)
73 "Parse DATE string and return a vector [year month day time timezone]. 73 "Parse DATE string and return a vector [year month day time timezone].
74 19 is prepended to year if necessary. Timezone in DATE is optional, it 74 19 is prepended to year if necessary. Timezone in DATE is optional, it
75 defaults to the value of htz:local. 75 defaults to the value of `htz:local'.
76 76
77 Recognizes the following styles: 77 Recognizes the following styles:
78 (1) 14 Apr 89 03:20[:12] [GMT] 78 (1) 14 Apr 89 03:20[:12] [GMT]
79 (2) Fri, 17 Mar [19]89 4:01[:33] [GMT] 79 (2) Fri, 17 Mar [19]89 4:01[:33] [GMT]
80 (3) Mon Jan 16 16:12[:37] [GMT] 1989 80 (3) Mon Jan 16 16:12[:37] [GMT] 1989
190 190
191 (defun htz:date-unix (&optional date local timezone) 191 (defun htz:date-unix (&optional date local timezone)
192 "Convert DATE or current date to a unix standard date. 192 "Convert DATE or current date to a unix standard date.
193 Optional 1st argument LOCAL specifies the local timezone of the DATE (default 193 Optional 1st argument LOCAL specifies the local timezone of the DATE (default
194 is the timezone embedded in the date or if there is none, then the value of 194 is the timezone embedded in the date or if there is none, then the value of
195 the variable, htz:local). Optional 2nd argument TIMEZONE specifies the 195 `htz:local'). Optional 2nd argument TIMEZONE specifies the timezone in which
196 timezone in which the date is returned; it defaults to the value of 196 the date is returned; it defaults to the value of `htz:local'."
197 htz:local."
198 (or (vectorp date) 197 (or (vectorp date)
199 (setq date (htz:date-parse (or date (current-time-string))))) 198 (setq date (htz:date-parse (or date (current-time-string)))))
200 (or local (setq local (or (aref date 4) htz:local))) 199 (or local (setq local (or (aref date 4) htz:local)))
201 (let* ((year (string-to-int (aref date 0))) 200 (let* ((year (string-to-int (aref date 0)))
202 (month (string-to-int (aref date 1))) 201 (month (string-to-int (aref date 1)))