Files
mgmt/examples/lang/datetime2.mcl
2025-05-02 03:12:18 -04:00

15 lines
362 B
Plaintext

import "datetime"
import "golang"
import "sys"
$now = datetime.now()
$st = struct{now => $now, load => $load,}
$load float = sys.load()->x1 # ambiguous so we specify the type!
file "/tmp/mgmt/datetime" {
state => $const.res.file.state.exists,
content => golang.template("Hello! It is now: {{ datetime_print .now }}\n\nload average: {{ .load }}\n", $st),
}