123456789101112131415161718192021222324 |
- (use-modules (zenity)
- (srfi srfi-19))
- (define (seconds->years s)
- (floor (/ s 60 60 24 356)))
- (let* ((birthday (or (zenity-calendar "What is your date of birth?")
- (exit)))
- (now (current-date))
- (birthday* (make-date 0 0 0 0
- (cdr (assoc 'day birthday))
- (cdr (assoc 'month birthday))
- (cdr (assoc 'year birthday))
- (date-zone-offset now))))
- (when (= (date-year-day now)
- (date-year-day birthday*))
- (display "Happy birthday!")
- (newline))
- (let* ((age-sec (time-second (time-difference (date->time-utc now)
- (date->time-utc birthday*))))
- (age (seconds->years age-sec)))
- (display (list "You are" age "years old"))
- (newline)))
|