Sha256: 21d3ead8ae3ef21dad11369a0e34bc8dd66cc0a75e614b6179bf9e0bcb109691
Contents?: true
Size: 745 Bytes
Versions: 396
Compression:
Stored size: 745 Bytes
Contents
;;; gigasecond.el --- Gigasecond exercise (exercism) ;;; Commentary: ;; Calculate the date one gigasecond (10^9 seconds) from the ;; given date. ;; ;; NB: Pay attention to Emacs' handling of time zones and dst ;; in the encode-time and decode-time functions. ;;; Code: (defun from (second minute hour day month year) "Calculate gigasecond from date given. Params are SECOND, MINUTE, HOUR, DAY, MONTH, and YEAR." (let ((gigasecond (seconds-to-time (expt 10 9))) (start-date (encode-time second minute hour day month year t))) (set-time-zone-rule t) (let ((end-date (decode-time (time-add start-date gigasecond)))) (butlast end-date (- (length end-date) 6))))) (provide 'gigasecond) ;;; gigasecond.el ends here
Version data entries
396 entries across 396 versions & 1 rubygems