-;;;--------------------------------------------------------------------------
-;;; Serial numbering.
-
-(defun make-zone-serial (name)
- "Given a zone NAME, come up with a new serial number. This will (very
- carefully) update a file ZONE.serial in the current directory."
- (let* ((file (format nil "~(~A~).serial" name))
- (last (with-open-file (in file
- :direction :input
- :if-does-not-exist nil)
- (if in (read in)
- (list 0 0 0 0))))
- (now (multiple-value-bind
- (sec min hr dy mon yr dow dstp tz)
- (get-decoded-time)
- (declare (ignore sec min hr dow dstp tz))
- (list dy mon yr)))
- (seq (cond ((not (equal now (cdr last))) 0)
- ((< (car last) 99) (1+ (car last)))
- (t (error "Run out of sequence numbers for ~A" name)))))
- (safely-writing (out file)
- (format out
- ";; Serial number file for zone ~A~%~
- ;; (LAST-SEQ DAY MONTH YEAR)~%~
- ~S~%"
- name
- (cons seq now)))
- (from-mixed-base '(100 100 100) (reverse (cons seq now)))))
-