Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock int
Example (Compare) ¶
// a new clock clock1 := New(10, 30) // a second clock, same as the first clock2 := New(10, 30) // are the clocks equal? fmt.Println(clock2 == clock1) // change the second clock clock2 = clock2.Add(30) // are the clocks equal now? fmt.Println(clock2 == clock1)
Output: true false
Example (New) ¶
// a new clock clock1 := New(10, 30) fmt.Println(clock1.String())
Output: 10:30
func (Clock) Add ¶
Example (Add) ¶
// create a clock clock := New(10, 30) // add 30 minutes to it clock = clock.Add(30) fmt.Println(clock.String())
Output: 11:00
Example (Subtract) ¶
// create a clock clock := New(10, 30) // subtract an hour and a half from it clock = clock.Add(-90) fmt.Println(clock.String())
Output: 09:00
Click to show internal directories.
Click to hide internal directories.