pconv_test.go 568 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2013-2014 Fuzamei tech Ltd. All rights reserved.
  2. package market
  3. // 本文件测试pconv周期转换接口
  4. import (
  5. "log"
  6. "testing"
  7. "time"
  8. )
  9. func TestConvTS(t *testing.T) {
  10. tm := time.Now()
  11. log.Println(tm)
  12. ts := int64(float64(tm.UnixNano()) * 1e-6)
  13. log.Println("ts:", getTime(ts))
  14. tm1 := convTS(ts, M1)
  15. log.Println("m1:", getTime(tm1))
  16. tm5 := convTS(ts, M5)
  17. log.Println("m5:", getTime(tm5))
  18. th1 := convTS(ts, H1)
  19. log.Println("h1:", getTime(th1))
  20. td1 := convTS(ts, D1)
  21. log.Println("d1:", getTime(td1))
  22. }