github.com/razvanm/vanadium-go-1.3@v0.0.0-20160721203343-4a65068e5915/src/runtime/ppapi/time_nacl.go (about)

     1  // Copyright 2014 The Go 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  package ppapi
     6  
     7  import (
     8  	"time"
     9  )
    10  
    11  func fromPPTime(t pp_Time) time.Time {
    12  	sec := int64(t)
    13  	nsec := int64(float64(t) - float64(sec))
    14  	return time.Unix(sec, nsec)
    15  }
    16  
    17  func toPPTime(t time.Time) pp_Time {
    18  	sec := t.Unix()
    19  	nsec := t.Nanosecond()
    20  	return pp_Time(sec) + pp_Time(nsec)*1000000000
    21  }