<commit_before>package tai64n

import (
	"encoding/binary"
	"encoding/hex"
	"fmt"
	"time"
)

// The number of seconds to offset the UNIX epoch to find the current
// TAI time.
const TAI64OriginalBase = 4611686018427387904

var (
	curLS       = time.Date(2015, time.July, 1, 0, 0, 0, 0, time.UTC)
	curLSOffset = 36
)

func nowBase(now time.Time) int64 {
	sec := now.Unix()

	// perf bias: most users set their server time to the current
	// time on earth, so we bias this to check that we're in that
	// time region before checking the complete leap second table.

	switch {
	case sec >= curLS.Unix():
		return int64(TAI64OriginalBase + curLSOffset)
	default:
		return int64(TAI64OriginalBase + LeapSecondsInvolved(now))
	}
}

// Indicates via Before, After, or Equal how to moments compare to eachother.
type TimeComparison int

const (
	Before TimeComparison = 0
	Equal  TimeComparison = iota
	After  TimeComparison = iota
)

// Return the current moment
func Now() *TAI64N {
	t := time.Now()

	return &TAI64N{
		Seconds:     uint64(t.Unix() + nowBase(t)),
		Nanoseconds: uint32(t.Nanosecond()),
	}
}

// Convert from a time.Time
func FromTime(t time.Time) *TAI64N {<commit_msg>Make the comparison values more standard<commit_after>package tai64n

import (
	"encoding/binary"
	"encoding/hex"
	"fmt"
	"time"
)

// The number of seconds to offset the UNIX epoch to find the current
// TAI time.
const TAI64OriginalBase = 4611686018427387904

var (
	curLS       = time.Date(2015, time.July, 1, 0, 0, 0, 0, time.UTC)
	curLSOffset = 36
)

func nowBase(now time.Time) int64 {
	sec := now.Unix()

	// perf bias: most users set their server time to the current
	// time on earth, so we bias this to check that we're in that
	// time region before checking the complete leap second table.

	switch {
	case sec >= curLS.Unix():
		return int64(TAI64OriginalBase + curLSOffset)
	default:
		return int64(TAI64OriginalBase + LeapSecondsInvolved(now))
	}
}

// Indicates via Before, After, or Equal how to moments compare to eachother.
type TimeComparison int

const (
	Before TimeComparison = -1
	Equal  TimeComparison = 0
	After  TimeComparison = 1
)

// Return the current moment
func Now() *TAI64N {
	t := time.Now()

	return &TAI64N{
		Seconds:     uint64(t.Unix() + nowBase(t)),
		Nanoseconds: uint32(t.Nanosecond()),
	}
}

// Convert from a time.Time
func FromTime(t time.Time) *TAI64N {
{'fraction_non_alphanumeric': 0.1046218487394958, 'fraction_numerical': 0.047058823529411764, 'mean_word_length': 3.659491193737769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1134398', 'n_tokens_mistral': 920, 'n_tokens_neox': 818, 'n_words': 277}