docs: add doc.go files and godoc comments to all packages

Add package-level documentation (doc.go) to all 22 first-party
packages and godoc comments to ~150 previously undocumented
exported symbols across common/, network/, and server/.
This commit is contained in:
Houmgaor
2026-02-18 21:39:13 +01:00
parent b9cb274ced
commit 2bd5f98f32
81 changed files with 342 additions and 0 deletions

4
common/gametime/doc.go Normal file
View File

@@ -0,0 +1,4 @@
// Package gametime provides time helpers anchored to the JST (UTC+9) timezone
// used by Monster Hunter Frontier's game clock, including weekly reset
// boundaries and the in-game absolute time cycle.
package gametime

View File

@@ -4,16 +4,19 @@ import (
"time"
)
// Adjusted returns the current time in JST (UTC+9), the timezone used by MHF.
func Adjusted() time.Time {
baseTime := time.Now().In(time.FixedZone("UTC+9", 9*60*60))
return time.Date(baseTime.Year(), baseTime.Month(), baseTime.Day(), baseTime.Hour(), baseTime.Minute(), baseTime.Second(), baseTime.Nanosecond(), baseTime.Location())
}
// Midnight returns today's midnight (00:00) in JST.
func Midnight() time.Time {
baseTime := time.Now().In(time.FixedZone("UTC+9", 9*60*60))
return time.Date(baseTime.Year(), baseTime.Month(), baseTime.Day(), 0, 0, 0, 0, baseTime.Location())
}
// WeekStart returns the most recent Monday at midnight in JST.
func WeekStart() time.Time {
midnight := Midnight()
offset := int(midnight.Weekday()) - int(time.Monday)
@@ -23,10 +26,13 @@ func WeekStart() time.Time {
return midnight.Add(-time.Duration(offset) * 24 * time.Hour)
}
// WeekNext returns the next Monday at midnight in JST.
func WeekNext() time.Time {
return WeekStart().Add(time.Hour * 24 * 7)
}
// GameAbsolute returns the current position within the 5760-second (96-minute)
// in-game day/night cycle, offset by 2160 seconds.
func GameAbsolute() uint32 {
return uint32((Adjusted().Unix() - 2160) % 5760)
}