convert.ss
#lang scheme/base
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DATE.plt
;;
;; date-specific routines.  Reexports srfi/19
;;
;; Bonzai Lab, LLC.  All rights reserved.
;;
;; Licensed under LGPL.
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; convert.ss - convert between plt & srfi/19 dates
;; yc 8/31/2009 - first version
(require (prefix-in s: srfi/19)
         "base.ss" 
         scheme/contract
         )

;; convert from plt date to srfi date
(define (date/plt->srfi/19 d)
  (s:make-date 0
               (date-second d) ;; why does this *expect*
               (date-minute d)
               (date-hour d)
               (date-day d)
               (date-month d)
               (date-year d)
               (date-time-zone-offset d)))

(define (date/srfi/19->plt s)
  (make-date (s:date-second s)
             (s:date-minute s)
             (s:date-hour s)
             (s:date-day s)
             (s:date-month s)
             (s:date-year s)
             (week-day s)
             (year-day s)
             #f ;; this eventually needs to have a way to determine whether this is true or false.
             (s:date-zone-offset s)))

(provide/contract 
 (date/srfi/19->plt (-> s:date? date?))
 (date/plt->srfi/19 (-> date? s:date?))
 )