2023-01-14 10:51:39 -05:00
|
|
|
// Copyright Terence J. Boldt (c)2020-2023
|
2021-10-30 09:50:00 -04:00
|
|
|
// Use of this source code is governed by an MIT
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2022-01-10 23:00:58 -05:00
|
|
|
// This file contains the handler for retrieving the ProDOS timestamp
|
2021-10-30 09:50:00 -04:00
|
|
|
// based on the current time
|
2021-11-03 05:33:09 -04:00
|
|
|
|
2021-05-30 07:18:39 -04:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
2021-10-11 07:52:24 -04:00
|
|
|
"github.com/tjboldt/ProDOS-Utilities/prodos"
|
2021-05-30 07:18:39 -04:00
|
|
|
)
|
|
|
|
|
2021-11-03 05:33:09 -04:00
|
|
|
// GetTimeCommand handles the request to get ProDOS time bytes
|
2021-05-30 07:18:39 -04:00
|
|
|
func GetTimeCommand() {
|
2022-03-04 18:24:59 -05:00
|
|
|
fmt.Printf("Sending date/time...")
|
2021-10-11 07:52:24 -04:00
|
|
|
prodosTime := prodos.DateTimeToProDOS(time.Now())
|
2021-05-30 07:18:39 -04:00
|
|
|
|
2021-10-11 07:52:24 -04:00
|
|
|
for i := 0; i < len(prodosTime); i++ {
|
2021-10-30 07:03:18 -04:00
|
|
|
comm.WriteByte(prodosTime[i])
|
2021-10-11 07:52:24 -04:00
|
|
|
}
|
2021-05-30 07:18:39 -04:00
|
|
|
|
2022-03-04 18:24:59 -05:00
|
|
|
fmt.Printf("%02X %02X %02X %02X\n", prodosTime[0], prodosTime[1], prodosTime[2], prodosTime[3])
|
2021-05-30 07:18:39 -04:00
|
|
|
}
|