github.com/0chain/gosdk@v1.17.11/zcnbridge/time/time.go (about)

     1  package time
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  const (
     8  	// RFC3339 is useful for formatting time.
     9  	RFC3339 = "2006-01-02T15:04:05Z07:00"
    10  )
    11  
    12  type (
    13  	// A Duration represents the elapsed time between two instants
    14  	// as an int64 nanosecond count. The representation limits the
    15  	// largest representable duration to approximately 290 years.
    16  	Duration = time.Duration
    17  
    18  	// Time is a copy of time from golang std lib
    19  	// to avoid import it from other packages.
    20  	Time = time.Time
    21  
    22  	// Timestamp represents a wrapper to control the json encoding.
    23  	Timestamp int64
    24  )
    25  
    26  // Now returns current Unix time.
    27  func Now() Timestamp {
    28  	return Timestamp(time.Now().Unix())
    29  }
    30  
    31  // NowTime returns the current local time.
    32  func NowTime() Time {
    33  	return time.Now()
    34  }