Documentation ¶
Overview ¶
The dtg package parses and prints time.Time in Allied Communication Publication (ACP) 121 Date-Time Group (DTG) format. This package is Copyright (C) 2022 SA6MWA Michel Blomgren.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DtgRegexp *regexp.Regexp = regexp.MustCompile(`^([0-9]{2})([0-9]{2})([0-9]{2})([A-Z]{0,1})(JAN|FEB|MAR|APR|MAY|MAJ|JUN|JUL|AUG|SEP|OCT|OKT|NOV|DEC){0,1}([0-9]{2}){0,1}$`) ErrInvalidDTG error = errors.New("invalid DTG format (minimally ddHHMM to complete ddHHMMZmmmYY)") ErrInvalidTimeZoneLetter error = errors.New("invalid time zone letter") ErrInvalidDtgVariadic error = errors.New("invalid DTG slice passed as variadic") )
Functions ¶
func GetNumericTimeZone ¶
func GetNumericTimeZone(dtgTimeZoneLetter string, dayHourMinuteMonthYear ...string) (*time.Location, error)
Return a time.Location (and error) with the numeric time zone representation (e.g +0100 or -1100) of an ACP 121 time zone letter (A-Z). Name field will be the numeric time zone (to parse with -0700). The variadic dayHourMinuteMonthYear string slice (optional) will parse this into a time.Time to use instead of time.Now() for the local time zone letter J (to present a daylight saving - DST - compensated offset). There is a String() function in time.Location to extract the numeric time zone as name is non-exported.
UTC-12: Y (e.g., Fiji) UTC-11: X (American Samoa) UTC-10: W (Honolulu, HI) UTC-9: V (Juneau, AK) UTC-8: U (PST, Los Angeles, CA) UTC-7: T (MST, Denver, CO) UTC-6: S (CST, Dallas, TX) UTC-5: R (EST, New York, NY) UTC-4: Q (Halifax, Nova Scotia) UTC-3: P (Buenos Aires, Argentina) UTC-2: O (Godthab, Greenland) UTC-1: N (Azores) UTC+-0: Z (Zulu time) UTC+1: A (France) UTC+2: B (Athens, Greece) UTC+3: C (Arab Standard Time, Iraq, Bahrain, Kuwait, Saudi Arabia, Yemen, Qatar) UTC+4: D (Used for Moscow, Russia, and Afghanistan, however, Afghanistan is technically +4:30 from UTC) UTC+5: E (Pakistan, Kazakhstan, Tajikistan, Uzbekistan, and Turkmenistan) UTC+6: F (Bangladesh) UTC+7: G (Thailand) UTC+8: H (Beijing, China) UTC+9: I (Tokyo, Japan) UTC+10: K (Brisbane, Australia) UTC+11: L (Sydney, Australia) UTC+12: M (Wellington, New Zealand)