-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathduration3.go
More file actions
30 lines (26 loc) · 812 Bytes
/
duration3.go
File metadata and controls
30 lines (26 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Seriál "Programovací jazyk Go"
// https://www.root.cz/serialy/programovaci-jazyk-go/
//
// Dvacátá první část
// Knihovny pro Go umožňující naplánování a spouštění periodických úloh
// https://www.root.cz/clanky/knihovny-pro-go-umoznujici-naplanovani-a-spousteni-periodickych-uloh/
//
// Repositář:
// https://github.com/tisnik/go-root/
//
// Seznam demonstračních příkladů z dvacáté první části:
// https://github.com/tisnik/go-root/blob/master/article_21/README.md
//
// Demonstrační příklad číslo 3:
// Práce s objektem typu Duration.
package main
import (
"fmt"
"time"
)
func main() {
d, _ := time.ParseDuration("200ms")
fmt.Println(d.String())
fmt.Printf("Seconds: %4.2f\n", d.Seconds())
fmt.Printf("ns: %d\n", d.Nanoseconds())
}