Skip to content

Commit

Permalink
Fix locale-specific time
Browse files Browse the repository at this point in the history
  • Loading branch information
part1zano committed Feb 10, 2024
1 parent 79c6dff commit 9510f2a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2297,7 +2297,6 @@ print_status_trim(vdev_stat_t *vs, boolean_t verbose)
!vs->vs_scan_removing) {
char zbuf[1024];
char tbuf[256];
struct tm zaction_ts;

time_t t = vs->vs_trim_action_time;
int trim_pct = 100;
Expand All @@ -2306,20 +2305,22 @@ print_status_trim(vdev_stat_t *vs, boolean_t verbose)
100 / (vs->vs_trim_bytes_est + 1));
}

(void) localtime_r(&t, &zaction_ts);
(void) strftime(tbuf, sizeof (tbuf), "%c", &zaction_ts);
(void) ctime_r(&t, tbuf);

switch (vs->vs_trim_state) {
case VDEV_TRIM_SUSPENDED:
(void) snprintf(zbuf, sizeof (zbuf), ", %s %s",
(void) snprintf(zbuf, sizeof (zbuf),
", %s %.24s",
gettext("suspended, started at"), tbuf);
break;
case VDEV_TRIM_ACTIVE:
(void) snprintf(zbuf, sizeof (zbuf), ", %s %s",
(void) snprintf(zbuf, sizeof (zbuf),
", %s %.24s",
gettext("started at"), tbuf);
break;
case VDEV_TRIM_COMPLETE:
(void) snprintf(zbuf, sizeof (zbuf), ", %s %s",
(void) snprintf(zbuf, sizeof (zbuf),
", %s %.24s",
gettext("completed at"), tbuf);
break;
}
Expand Down

0 comments on commit 9510f2a

Please sign in to comment.