force America/Toronto time zone

This commit is contained in:
Andrew Wang 2022-01-07 17:49:59 -05:00
parent fe1d5116ab
commit a208b8abe8
1 changed files with 8 additions and 2 deletions

View File

@ -44,6 +44,12 @@ func SendAndLog(conn net.Conn, msg string) {
} }
func SendStatus(conn net.Conn) { func SendStatus(conn net.Conn) {
// Force arthur to send back time information in America/Toronto time
location, err := time.LoadLocation("America/Toronto")
if err != nil {
logger.ErrLog(err)
}
status := tabwriter.NewWriter(conn, 5, 5, 5, ' ', 0) status := tabwriter.NewWriter(conn, 5, 5, 5, ' ', 0)
fmt.Fprintf(status, "Repository\tLast Synced\tNext Expected Sync\tRunning\n") fmt.Fprintf(status, "Repository\tLast Synced\tNext Expected Sync\tRunning\n")
@ -61,8 +67,8 @@ func SendStatus(conn net.Conn) {
fmt.Fprintf(status, "%s\t%s\t%s\t%t\n", fmt.Fprintf(status, "%s\t%s\t%s\t%t\n",
name, name,
time.Unix(lastSync, 0).Format(time.RFC1123), time.Unix(lastSync, 0).In(location).Format(time.RFC1123),
time.Unix(nextSync, 0).Format(time.RFC1123), time.Unix(nextSync, 0).In(location).Format(time.RFC1123),
repo.State.IsRunning, repo.State.IsRunning,
) )
} }