testnano.go 468 B

1234567891011121314151617181920212223
  1. package main
  2. import (
  3. "fmt"
  4. "time"
  5. "git.wecise.com/wecise/odbserver/odb/util"
  6. )
  7. func EncodeNanoTime(ctime int64) float64 {
  8. ms := int64(ctime / 1e6)
  9. return float64(ms) + float64(ctime-ms*1e6)/1e6
  10. }
  11. func main() {
  12. ctime := time.Now().UnixNano()
  13. //fmt.Printf( "==> %d \n", int( (msseconds+util.G_TIME_ZONE*1000)/(86400000) ) )
  14. fmt.Printf("==> %d \n", ((ctime+util.G_TIME_ZONE*1e9)/3600/1e9)%24)
  15. fmt.Printf("%v, %f", uint64(ctime), EncodeNanoTime(ctime))
  16. }