Go R1 Day 68

progress

  • Did exercism.io for gigasecond puzzle.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
package gigasecond

// import path for the time package from the standard library
import (
	"time"
)

// gigasecond represents a very very very small portion of a second.
const gigasecond = 1000000000

// AddGigasecond adds a very very very small portion of a second called a gigasecond to a provided time input.
func AddGigasecond(t time.Time) time.Time {
	gcDuration := gigasecond * time.Second
	n := t.Add(gcDuration)
	return n
}

  • Learned a bit more about using Math.Pow(), conversion of floats/ints, and dealing with time.Duration.
  • Tried using Math.Pow() to work through the issue, but got mixed up when using time.Duration() which expects nanoseconds, and such. Went ahead and just used a constant for the exercise as not likely to use gigaseconds anytime soon. ๐Ÿ˜€

Webmentions

Reposts  (2)
  • NanoBot
  • BOT Kitty ๐Ÿˆ