energy/common/common_test.go
2022-12-07 15:50:59 +08:00

34 lines
773 B
Go

//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under GNU General Public License v3.0
//
//----------------------------------------
package common
import (
"fmt"
"testing"
"time"
)
func TestGoTimeToDTime(t *testing.T) {
for i := 0; i < 1; i++ {
var now = time.Now()
fmt.Println("now", now)
var dNow = GoDateTimeToDDateTime(now)
fmt.Println("dNow", dNow)
var gNow = DDateTimeToGoDateTime(dNow)
fmt.Println("gNow", gNow)
fmt.Println("==========")
}
//1/24 + (1/24)/60*x
//x=60162037037
fmt.Println(63422453704 * 1000 / int64(time.Second))
fmt.Println(62710648148 * 1000 / int64(time.Second))
sub := time.Now().Sub(time.Date(2022, 10, 5, 0, 0, 0, 0, time.UTC))
fmt.Println(sub.Seconds())
}