mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-16 01:59:29 +02:00
Do not apply locale formatting to Unix timestamps
This commit is contained in:
parent
1698568d0e
commit
5755ccef01
1 changed files with 8 additions and 4 deletions
|
@ -18,6 +18,7 @@ package cli
|
|||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -106,7 +107,7 @@ func (c *TransferCmd[E, I, R]) Transfer(exp backends.ExportProcessor[R], imp bac
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(i18n.Tr("From timestamp: %v (%v)", timestamp, timestamp.Unix()))
|
||||
printTimestamp("From timestamp: %v (%v)", timestamp)
|
||||
|
||||
// Prepare progress bars
|
||||
exportProgress := make(chan models.Progress)
|
||||
|
@ -129,8 +130,7 @@ func (c *TransferCmd[E, I, R]) Transfer(exp backends.ExportProcessor[R], imp bac
|
|||
wg.Wait()
|
||||
progress.Wait()
|
||||
if result.Error != nil {
|
||||
fmt.Println(i18n.Tr("Import failed, last reported timestamp was %v (%v)",
|
||||
result.LastTimestamp, result.LastTimestamp.Unix()))
|
||||
printTimestamp("Import failed, last reported timestamp was %v (%s)", result.LastTimestamp)
|
||||
return result.Error
|
||||
}
|
||||
fmt.Println(i18n.Tr("Imported %v of %v %s into %v.",
|
||||
|
@ -168,7 +168,11 @@ func (c *TransferCmd[E, I, R]) updateTimestamp(result models.ImportResult, oldTi
|
|||
if result.LastTimestamp.Unix() < oldTimestamp.Unix() {
|
||||
result.LastTimestamp = oldTimestamp
|
||||
}
|
||||
fmt.Println(i18n.Tr("Latest timestamp: %v (%v)\n", result.LastTimestamp, result.LastTimestamp.Unix()))
|
||||
printTimestamp("Latest timestamp: %v (%v)", result.LastTimestamp)
|
||||
err := c.db.SetImportTimestamp(c.sourceName, c.targetName, c.entity, result.LastTimestamp)
|
||||
return err
|
||||
}
|
||||
|
||||
func printTimestamp(s string, t time.Time) {
|
||||
fmt.Println(i18n.Tr(s, t, strconv.FormatInt(t.Unix(), 10)))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue