aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs/libzfs_pool.c
diff options
context:
space:
mode:
authorMaxim Filimonov <[email protected]>2024-04-09 02:37:41 +0400
committerTony Hutter <[email protected]>2024-04-29 13:50:05 -0700
commit86b39b41a0311d109f3558b65a203a7aeb568472 (patch)
tree7cd1c00eb753ba5a71918580d4662252e3e40431 /lib/libzfs/libzfs_pool.c
parent531572b5906a0a4d042b7dcfd09b3ea947bd442e (diff)
Fix locale-specific time
In `zpool status -t`, scrub date/time is reported using the C locale, while trim time is reported using the current one. This is inconsistent. This patch fixes that. Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Maxim Filimonov <[email protected]> Closes #15878 Closes #15879
Diffstat (limited to 'lib/libzfs/libzfs_pool.c')
-rw-r--r--lib/libzfs/libzfs_pool.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c
index 7f01143d5..6d5ac9d59 100644
--- a/lib/libzfs/libzfs_pool.c
+++ b/lib/libzfs/libzfs_pool.c
@@ -1899,7 +1899,8 @@ zpool_rewind_exclaim(libzfs_handle_t *hdl, const char *name, boolean_t dryrun,
(void) nvlist_lookup_int64(nv, ZPOOL_CONFIG_REWIND_TIME, &loss);
if (localtime_r((time_t *)&rewindto, &t) != NULL &&
- strftime(timestr, 128, "%c", &t) != 0) {
+ ctime_r((time_t *)&rewindto, timestr) != NULL) {
+ timestr[24] = 0;
if (dryrun) {
(void) printf(dgettext(TEXT_DOMAIN,
"Would be able to return %s "
@@ -1961,7 +1962,8 @@ zpool_explain_recover(libzfs_handle_t *hdl, const char *name, int reason,
"Recovery is possible, but will result in some data loss.\n"));
if (localtime_r((time_t *)&rewindto, &t) != NULL &&
- strftime(timestr, 128, "%c", &t) != 0) {
+ ctime_r((time_t *)&rewindto, timestr) != NULL) {
+ timestr[24] = 0;
(void) printf(dgettext(TEXT_DOMAIN,
"\tReturning the pool to its state as of %s\n"
"\tshould correct the problem. "),