github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/cmds/core/date/date_unix.go (about) 1 // Copyright 2015-2017 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build !plan9 6 7 package main 8 9 import ( 10 "log" 11 "syscall" 12 "time" 13 ) 14 15 func setDate(d string, z *time.Location) error { 16 t, err := getTime(z, d) 17 if err != nil { 18 log.Fatalf("%v: %v", d, err) 19 } 20 tv := syscall.NsecToTimeval(t.UnixNano()) 21 return syscall.Settimeofday(&tv) 22 }