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

Version Path
trackler-2.2.1.139 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.138 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.137 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.136 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.135 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.134 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.133 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.132 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.131 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.130 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.129 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.128 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.127 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.126 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.125 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.124 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.123 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.122 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.121 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.120 tracks/elisp/exercises/gigasecond/example.el