Documentation ¶
Index ¶
- Constants
- type NauticalTime
- func (nt *NauticalTime) GetHours() (int, error)
- func (nt *NauticalTime) SetFormat(format int) error
- func (nt *NauticalTime) SetHours(hours int) error
- func (nt *NauticalTime) SetMidday(midday int) error
- func (nt *NauticalTime) SetMinutes(minutes int) error
- func (nt *NauticalTime) String() (string, error)
Constants ¶
const ( AM = 1 PM = 2 HOUR_12 = 12 HOUR_24 = 24 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NauticalTime ¶
type NauticalTime struct { // Format contains the string representation of the Time Format Format int `json:"timeFormat,omitempty"` // Midday contains the string representation of the AM/PM value Midday int `json:"midday,omitempty"` // Minutes is the number of minutes past the hour. Values are valid 0-59 Minutes int `json:"minutes" default:"0"` // Hours is the hour of the day. times are assumed in 24 hour format unless // data from Midday or Format conflict with this information. // Values re valid 0-23 Hours int `json:"hours" default:"0"` }
NauticalTime provides time of day as well as data parsing from the NOAA site
func ConvertNOAATime ¶
func ConvertNOAATime(originalTimeStr string) (*NauticalTime, error)
ConvertNOAATime converts a string time into a NauticalTime struct. Strings originating on NOAA's website have the `nonBreakingSpace` embedded in them. This function will parse these strings as well as strings formatted from the String function from the NauticalTime struct in the format: "00:00:00". Strings in the format "00:00 AM/PM" will also be parsed here.
func (*NauticalTime) GetHours ¶
func (nt *NauticalTime) GetHours() (int, error)
GetHours will get the current value in hours in a 24 hour time format.
func (*NauticalTime) SetFormat ¶
func (nt *NauticalTime) SetFormat(format int) error
SetFormat sets the current time format, 24 vs 12 hour time format. Based on the current value of the hours, a value >= 12 will set Midday to PM all other times are assumed AM.
func (*NauticalTime) SetHours ¶
func (nt *NauticalTime) SetHours(hours int) error
SetHours sets the hours of the NauticalTime struct
func (*NauticalTime) SetMidday ¶
func (nt *NauticalTime) SetMidday(midday int) error
SetMidday will set the AM/PM value and adjust the hours for the NauticalTime struct. The current format MUST be HOUR_12 for this function to complete.
func (*NauticalTime) SetMinutes ¶
func (nt *NauticalTime) SetMinutes(minutes int) error
SetMinutes sets the current minutes of the NauticalTime struct
func (*NauticalTime) String ¶
func (nt *NauticalTime) String() (string, error)
String formats a string representation of the NauticalTime struct. The following format is returned "00:00:00" where the seconds will always be 0.