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.180 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.179 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.178 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.177 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.176 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.175 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.174 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.173 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.172 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.171 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.170 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.169 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.167 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.166 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.165 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.164 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.163 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.162 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.161 tracks/elisp/exercises/gigasecond/example.el
trackler-2.2.1.160 tracks/elisp/exercises/gigasecond/example.el