Sha256: 5deda3f182016c09fdeeddecd7dddd1eae5041274d5e001b54526621765878d0

Contents?: true

Size: 308 Bytes

Versions: 274

Compression:

Stored size: 308 Bytes

Contents

package clock

import "fmt"

const testVersion = 4

type Clock int

func New(h, m int) Clock {
	c := Clock((h*60 + m) % 1440)
	if c < 0 {
		c += 1440
	}
	return c
}

func (c Clock) Add(m int) Clock {
	return New(0, int(c)+m)
}

func (c Clock) String() string {
	return fmt.Sprintf("%02d:%02d", c/60, c%60)
}

Version data entries

274 entries across 274 versions & 1 rubygems

Version Path
trackler-2.2.1.56 tracks/go/exercises/clock/example.go
trackler-2.2.1.55 tracks/go/exercises/clock/example.go
trackler-2.2.1.54 tracks/go/exercises/clock/example.go
trackler-2.2.1.53 tracks/go/exercises/clock/example.go
trackler-2.2.1.52 tracks/go/exercises/clock/example.go
trackler-2.2.1.51 tracks/go/exercises/clock/example.go
trackler-2.2.1.50 tracks/go/exercises/clock/example.go
trackler-2.2.1.49 tracks/go/exercises/clock/example.go
trackler-2.2.1.48 tracks/go/exercises/clock/example.go
trackler-2.2.1.47 tracks/go/exercises/clock/example.go
trackler-2.2.1.46 tracks/go/exercises/clock/example.go
trackler-2.2.1.45 tracks/go/exercises/clock/example.go
trackler-2.2.1.44 tracks/go/exercises/clock/example.go
trackler-2.2.1.43 tracks/go/exercises/clock/example.go
trackler-2.2.1.42 tracks/go/exercises/clock/example.go
trackler-2.2.1.41 tracks/go/exercises/clock/example.go
trackler-2.2.1.40 tracks/go/exercises/clock/example.go
trackler-2.2.1.39 tracks/go/exercises/clock/example.go
trackler-2.2.1.38 tracks/go/exercises/clock/example.go
trackler-2.2.1.37 tracks/go/exercises/clock/example.go