1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Upgrade rescuesdriq tool to new header spec

This commit is contained in:
Andreas Baulig 2021-08-04 14:10:52 +00:00
parent e8a8ef6f3d
commit 92027b4511
No known key found for this signature in database
GPG Key ID: 5225DCE5A4A2EE20
2 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ The header is composed as follows:
- Sample rate in S/s (4 bytes, 32 bits) - Sample rate in S/s (4 bytes, 32 bits)
- Center frequency in Hz (8 bytes, 64 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) - Sample size as 16 or 24 bits (4 bytes, 32 bits)
- filler with all zeroes (4 bytes, 32 bits) - filler with all zeroes (4 bytes, 32 bits)
- CRC32 (IEEE) of the 28 bytes above (4 bytes, 32 bits) - CRC32 (IEEE) of the 28 bytes above (4 bytes, 32 bits)

View File

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