github.com/blend/go-sdk@v1.20240719.1/timeutil/unix_milliseconds.go (about)

     1  /*
     2  
     3  Copyright (c) 2024 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package timeutil
     9  
    10  import "time"
    11  
    12  // UnixMilliseconds returns the time in unix (seconds) format
    13  // with a floating point remainder for subsecond fraction.
    14  func UnixMilliseconds(t time.Time) float64 {
    15  	nanosPerSecond := float64(time.Second) / float64(time.Nanosecond)
    16  	return float64(t.UnixNano()) / nanosPerSecond
    17  }