[go: up one dir, main page]

File: classes.lisp

package info (click to toggle)
cl-local-time 1.1.6-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 188 kB
  • ctags: 203
  • sloc: lisp: 1,374; sh: 89; makefile: 75
file content (31 lines) | stat: -rw-r--r-- 979 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
;;; -*- Mode: Lisp -*-
;;; $Id: classes.lisp,v 1.5 2001/11/12 19:48:20 jesse Exp $
;;;
;;; Copyright (c) 2000, 2001 onShore Development, Inc.

(in-package :local-time)

(eval-when (:compile-toplevel :load-toplevel)

(defstruct (local-time (:constructor %make-local-time)
                       (:print-function %print-local-time))
  (day 0)
  (sec 0)
  (msec 0))

(defstruct (duration (:include local-time)
                     (:constructor %make-duration)
                     (:print-function %print-duration)))
)                                     ; eval-when

(defun %print-local-time (local-time stream depth)
  (declare (ignore depth))
  (format stream "#<LOCAL-TIME: ~a>" (format-timestring nil local-time)))

(defun %print-duration (local-time stream depth)
  (declare (ignore depth))
  (multiple-value-bind (ms ss mm hh day)
      (decode-duration local-time)
    (format stream "#<DURATION: ~d day~p, ~2,'0d:~2,'0d:~2,'0d.~2,'0d>"
            day day hh mm ss ms)))