Skip to content

Commit 52cd66e

Browse files
authored
Fix two issues related to #8718. (#8721)
First was that a string like "1920T" was not recognizes as an absolute time (contrary to documentation). Automatic annotations (-Ba) were failing miserably for when -R were given in years (and probably other time units as well) because the guessing function is always expecting times in seconds.
1 parent 97cca2f commit 52cd66e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/gmt_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10136,7 +10136,7 @@ unsigned int gmtlib_is_time (struct GMT_CTRL *GMT, char *text) {
1013610136
gmt_strrepc (string, p[k], ' '); /* Replace date separators with space */
1013710137
if (n_colon)
1013810138
gmt_strrepc (string, ':', ' '); /* Replace time separators with space */
10139-
if ((n_dash >= 1 && n_slash == 0) || (n_dash == 0 && n_slash >= 1)) {
10139+
if (((n_dash >= 1 && n_slash == 0) || (n_dash == 0 && n_slash >= 1)) || (n_dash == 0 && n_slash == 0 && string[L] == 'T')) {
1014010140
/* Apart from random junk SHIT 5 6 7:X:Hello!, Possibilities are:
1014110141
* 1. yyyy mm dd[T][hh.xxx|:mm.xx|:ss.xx] Full date and possibly time
1014210142
* 2. yyyy jjj[T][hh.xxx|:mm.xx|:ss.xx] Julian day and possibly time

src/gmt_map.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6915,6 +6915,9 @@ void gmt_auto_frame_interval (struct GMT_CTRL *GMT, unsigned int axis, unsigned
69156915
}
69166916
f *= GMT->session.u2u[GMT_INCH][GMT_PT]; /* Change to points */
69176917

6918+
if (is_time && GMT->current.setting.time_system.scale != 1.0) /* Because gmtmap_auto_time_increment always expects the time in seconds */
6919+
d *= GMT->current.setting.time_system.scale;
6920+
69186921
#ifndef NO_THEMES
69196922
if (GMT->current.setting.run_mode == GMT_MODERN && gmt_M_axis_is_geo (GMT, axis)) { /* Need more space for degree symbol and WESN letters not considered in the algorithm */
69206923
if (strchr (GMT->current.setting.format_geo_map, 'F')) /* Need more space for degree symbol and letter */

0 commit comments

Comments
 (0)