Skip to content

Commit

Permalink
Renaming variable (#117)
Browse files Browse the repository at this point in the history
Better readability.
  • Loading branch information
joakimmoller authored May 29, 2020
1 parent 4734754 commit e3f9beb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/ccsds/cuc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"
)

var milliesPerSecond float64 = math.Pow10(9)
const nanosPerSecond float64 = 1e9

// TAI is the CCSDS recommended epoch for unsegmented time
var TAI = time.Date(1958, time.January, 1, 0, 0, 0, 0, time.UTC)
Expand All @@ -23,11 +23,11 @@ var TAI = time.Date(1958, time.January, 1, 0, 0, 0, 0, time.UTC)
// * coarseTime is time since epoch in seconds
// * fineTime is subseconds is a binary division of a second
func UnsegmentedTimeNanoseconds(coarseTime uint32, fineTime uint16) int64 {
var nanos int64 = int64(coarseTime) * int64(milliesPerSecond)
var nanos int64 = int64(coarseTime) * int64(nanosPerSecond)
var fine = big.NewFloat(float64(fineTime))
fine.SetMantExp(fine, -16)
fineValue, _ := fine.Float64()
return nanos + int64(math.Round(fineValue*milliesPerSecond))
return nanos + int64(math.Round(fineValue*nanosPerSecond))
}

// UnsegmentedTimeDate iterprets CCSDS Unsegmented time Code (CUC)
Expand Down

0 comments on commit e3f9beb

Please sign in to comment.