Fix Height conversion and update DateTime comment

- Update the comment for DateTime() to accurately describe its functionality
- Fix the Height conversion (CentiMeter and MilliMeter) calculations by changing the division to multiplication

This commit ensures that the conversion functions work as intended and improves the description for DateTime().
This commit is contained in:
Winni Neessen 2023-06-27 17:18:15 +02:00
parent a4f19380ff
commit 9c65eca128
Signed by: wneessen
GPG key ID: 5F3AF39B820C119D

View file

@ -20,8 +20,7 @@ func (h Height) IsAvailable() bool {
return !h.na return !h.na
} }
// DateTime returns true if an Height value was // DateTime returns the timestamp associated with the Height value
// available at time of query
func (h Height) DateTime() time.Time { func (h Height) DateTime() time.Time {
return h.dt return h.dt
} }
@ -64,7 +63,7 @@ func (h Height) CentiMeter() float64 {
if h.na { if h.na {
return math.NaN() return math.NaN()
} }
return h.fv / 100 return h.fv * 100
} }
// CentiMeterString returns the Height type as formatted string in centimeters // CentiMeterString returns the Height type as formatted string in centimeters
@ -77,7 +76,7 @@ func (h Height) MilliMeter() float64 {
if h.na { if h.na {
return math.NaN() return math.NaN()
} }
return h.fv / 1000 return h.fv * 1000
} }
// MilliMeterString returns the Height type as formatted string in millimeters // MilliMeterString returns the Height type as formatted string in millimeters