<commit_before>package index

import "time"

type TimeQuantum uint

const (
	Y TimeQuantum = 0
	YM
	YMD
	YMDH
)

func GetTimeID(t TimeQuantum, year uint, month uint, day uint, hour uint, tile_id uint64) uint64 {
	y := year - 1970 //config.startyear
	time_stamp := uint64((uint(t) << 30) | (y << 23) | (month << 19) | (day << 14) | (hour << 9))
	time_stamp = time_stamp << 32
	return time_stamp | tile_id
}

func GetTimeIds(tile_id uint64, atime time.Time, min_quantum TimeQuantum) []uint64 {
	results := make([]uint64, 0, 4)
	year := uint(atime.Year())
	month := atime.Month()
	day := atime.Day()
	hour := atime.Hour()

	if min_quantum <= Y {
		id := GetTimeID(Y, year, 0, 0, 0, tile_id)
		results = append(results, id)
	}

	if min_quantum <= YM {
		id := GetTimeID(YM, uint(year), uint(month), 0, 0, tile_id)
		results = append(results, id)
	}

	if min_quantum <= YMD {
		id := GetTimeID(YMD, year, uint(month), uint(day), 0, tile_id)
		results = append(results, id)
	}

	if min_quantum <= YMDH {
		id := GetTimeID(Y, year, uint(month), uint(day), uint(hour), tile_id)
		results = append(results, id)
	}

	return results
}

func IncrementYear(t time.Time) time.Time {
	return t.AddDate(1, 0, 0)
}
func IncrementMonth(t time.Time) time.Time {
	return t.AddDate(0, 1, 0)
}
func IncrementDay(t time.Time) time.Time {
	return t.AddDate(0, 0, 1)
}
func IncrementHour(t time.Time) time.Time {
	return t.Add(time.Hour)
}

func sameYear(t1, t2 time.Time) bool {
	y1, _, _ := t1.Date()
	y2, _, _ := t2.Date()
	return (y1 == y2)
}
<commit_msg>setting time quantum value on date tiles<commit_after>package index

import (
	"time"
)

type TimeQuantum uint

const (
	Y    TimeQuantum = 3
	YM   TimeQuantum = 2
	YMD  TimeQuantum = 1
	YMDH TimeQuantum = 0
)

func GetTimeID(t TimeQuantum, year uint, month uint, day uint, hour uint, tile_id uint64) uint64 {
	y := year - 1970 //config.startyear
	time_stamp := uint64((uint(t) << 30) | (y << 23) | (month << 19) | (day << 14) | (hour << 9))
	time_stamp = time_stamp << 32
	result := time_stamp | tile_id

	return result
}

func GetTimeIds(tile_id uint64, atime time.Time, min_quantum TimeQuantum) []uint64 {
	results := make([]uint64, 0, 4)
	year := uint(atime.Year())
	month := atime.Month()
	day := atime.Day()
	hour := atime.Hour()

	if min_quantum <= Y {
		id := GetTimeID(Y, year, 0, 0, 0, tile_id)
		results = append(results, id)
	}

	if min_quantum <= YM {
		id := GetTimeID(YM, uint(year), uint(month), 0, 0, tile_id)
		results = append(results, id)
	}

	if min_quantum <= YMD {
		id := GetTimeID(YMD, year, uint(month), uint(day), 0, tile_id)
		results = append(results, id)
	}

	if min_quantum <= YMDH {
		id := GetTimeID(YMDH, year, uint(month), uint(day), uint(hour), tile_id)
		results = append(results, id)
	}

	return results
}

func IncrementYear(t time.Time) time.Time {
	return t.AddDate(1, 0, 0)
}
func IncrementMonth(t time.Time) time.Time {
	return t.AddDate(0, 1, 0)
}
func IncrementDay(t time.Time) time.Time {
	return t.AddDate(0, 0, 1)
}
func IncrementHour(t time.Time) time.Time {
	return t.Add(time.Hour)
}

func sameYear(t1, t2 time.Time) bool {
	y1, _, _ := t1.Date()
	y2, _, _ := t2.Date()
	return (y1 == y2)
}

{'fraction_non_alphanumeric': 0.15648614609571787, 'fraction_numerical': 0.03431989924433249, 'mean_word_length': 3.8726993865030677, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 3, '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': '5787350', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1273, 'n_words': 344}