Upgrade rescuesdriq tool to new header spec

pull/981/head
Andreas Baulig 2021-08-04 14:10:52 +00:00
rodzic e8a8ef6f3d
commit 92027b4511
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 5225DCE5A4A2EE20
2 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -8,7 +8,7 @@ The header is composed as follows:
- Sample rate in S/s (4 bytes, 32 bits)
- Center frequency in Hz (8 bytes, 64 bits)
- Start time Unix timestamp epoch in seconds (8 bytes, 64 bits)
- Start time Unix timestamp epoch in milliseconds (8 bytes, 64 bits)
- Sample size as 16 or 24 bits (4 bytes, 32 bits)
- filler with all zeroes (4 bytes, 32 bits)
- CRC32 (IEEE) of the 28 bytes above (4 bytes, 32 bits)

Wyświetl plik

@ -71,7 +71,7 @@ func printHeader(header *HeaderStd) {
fmt.Println("Sample rate:", header.SampleRate)
fmt.Println("Frequency :", header.CenterFrequency)
fmt.Println("Sample Size:", header.SampleSize)
tm := time.Unix(header.StartTimestamp, 0)
tm := time.Unix(header.StartTimestamp / 1000, header.StartTimestamp % 1000)
fmt.Println("Start :", tm)
fmt.Println("CRC32 :", header.CRC32)
fmt.Println("CRC32 OK :", GetCRC(header))
@ -152,13 +152,13 @@ func main() {
if flagSeen["ts"] {
t, err := time.Parse(time.RFC3339, *timeStr)
if err == nil {
headerOrigin.StartTimestamp = t.Unix()
headerOrigin.StartTimestamp = t.UnixNano() / int64(time.Millisecond)
} else {
fmt.Println("Incorrect time specified. Defaulting to now")
headerOrigin.StartTimestamp = int64(time.Now().Unix())
headerOrigin.StartTimestamp = int64(time.Now().UnixNano() / int64(time.Millisecond))
}
} else if *timeNow {
headerOrigin.StartTimestamp = int64(time.Now().Unix())
headerOrigin.StartTimestamp = int64(time.Now().Unix() * 1000)
}
fmt.Println("\nHeader is now")