Gigasecond

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

Version compatibility

This exercise has been tested on Julia versions >=1.0.

Submitting Incomplete Solutions

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

Your solution


In [ ]:
# submit
function add_gigasecond(date::DateTime)

end

Test suite


In [ ]:
using Test
using Dates

# include("gigasecond.jl")

samples = Dict(
    DateTime("2011-04-25") => DateTime("2043-01-01T01:46:40"),
    DateTime("1977-06-13") => DateTime("2009-02-19T01:46:40"),
    DateTime("1959-07-19") => DateTime("1991-03-27T01:46:40"),
    DateTime("2015-01-24T22:00:00") => DateTime("2046-10-02T23:46:40"),
    DateTime("2015-01-24T23:59:59") => DateTime("2046-10-03T01:46:39")
)

@testset "add gigasecond to $sample[1]" for sample in samples
    @test add_gigasecond(sample[1]) == sample[2]
end

Prepare submission

To submit your exercise, you need to save your solution in a file called gigasecond.jl before using the CLI. You can either create it manually or use the following functions, which will automatically write every notebook cell that starts with # submit to the file gigasecond.jl.


In [ ]:
# using Pkg; Pkg.add("Exercism")
# using Exercism
# Exercism.create_submission("gigasecond")