Sha256: 68570594638d1d0afeada3d9c961f35b71141152f945331487ff13d1c5614f05
Contents?: true
Size: 352 Bytes
Versions: 78
Compression:
Stored size: 352 Bytes
Contents
package clock import "fmt" 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) Subtract(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
78 entries across 78 versions & 1 rubygems