# laszpio's solution

## to Gigasecond in the Clojure Track

Published at Jan 13 2021 · 0 comments
Instructions
Test suite
Solution

Given a moment, determine the moment that would be after a gigasecond has passed.

A gigasecond is 10^9 (1,000,000,000) seconds.

## Source

Chapter 9 in Chris Pine's online Learn to Program tutorial. http://pine.fm/LearnToProgram/?Chapter=09

## Submitting Incomplete Solutions

It's possible to submit an incomplete solution so you can see how others have completed the exercise.

### gigasecond_test.clj

(ns gigasecond-test
(:require [clojure.test :refer [deftest is]]
gigasecond))

(deftest from-apr-25-2011
(is (= [2043 1 1] (gigasecond/from 2011 4 25))))

(deftest from-jun-13-1977
(is (= [2009 2 19] (gigasecond/from 1977 6 13))))

(deftest from-jul-19-1959
(is (= [1991 3 27] (gigasecond/from 1959 7 19))))

;; customize this to test your birthday and find your gigasecond date:
;; (deftest your-birthday
;;   (is (= [year2 month2 day2] (gigasecond/from year1 month1 day1))))
(ns gigasecond
(:require [clj-time.core :as t]))

(def gigasecond (t/seconds 1000000000N))

(defn from [year month day]
(->
(t/date-time year month day)
(t/plus gigasecond)
((juxt t/year t/month t/day))))
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}