internal/protocol/time.go
func timeToJulianDay(t time.Time) int {

	t = t.UTC()

	month := int(t.Month())

	a := (14 - month) / 12
	y := t.Year() + 4800 - a
	m := month + (12 * a) - 3

	if t.Before(gregorianDate) { // Julian Calendar
		return t.Day() + (153*m+2)/5 + 365*y + y/4 - 32083
	}
	// Gregorian Calendar
	return t.Day() + (153*m+2)/5 + 365*y + y/4 - y/100 + y/400 - 32045
}
func timeToJulianDay(t time.Time) int {

	t = t.UTC()

	month := int(t.Month())

	a := (14 - month) / 12
	y := t.Year() + 4800 - a
	m := month + (12 * a) - 3

	if t.Before(gregorianDate) { // Julian Calendar
		return t.Day() + (153*m+2)/5 + 365*y + y/4 - 32083
	}
	// Gregorian Calendar
	return t.Day() + (153*m+2)/5 + 365*y + y/4 - y/100 + y/400 - 32045
}
func timeToJulianDay ( t time . Time ) int { t = t . UTC ( ) month := int ( t . Month ( ) ) a := ( 14 - month ) / 12 y := t . Year ( ) + 4800 - a m := month + ( 12 * a ) - 3 if t . Before ( gregorianDate ) { // Julian Calendar return t . Day ( ) + ( 153 * m + 2 ) / 5 + 365 * y + y / 4 - 32083 } // Gregorian Calendar return t . Day ( ) + ( 153 * m + 2 ) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 32045 }
// timeToJulianDay returns the Julian Date Number of time's date components.
// The algorithm is taken from https://en.wikipedia.org/wiki/Julian_day.
timeToJulianDay returns the Julian Date Number of time s date components . The algorithm is taken from https : // en . wikipedia . org / wiki / Julian_day .