mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-16 10:09:28 +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 (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ func (c *TransferCmd[E, I, R]) Transfer(exp backends.ExportProcessor[R], imp bac
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println(i18n.Tr("From timestamp: %v (%v)", timestamp, timestamp.Unix()))
|
printTimestamp("From timestamp: %v (%v)", timestamp)
|
||||||
|
|
||||||
// Prepare progress bars
|
// Prepare progress bars
|
||||||
exportProgress := make(chan models.Progress)
|
exportProgress := make(chan models.Progress)
|
||||||
|
@ -129,8 +130,7 @@ func (c *TransferCmd[E, I, R]) Transfer(exp backends.ExportProcessor[R], imp bac
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
progress.Wait()
|
progress.Wait()
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
fmt.Println(i18n.Tr("Import failed, last reported timestamp was %v (%v)",
|
printTimestamp("Import failed, last reported timestamp was %v (%s)", result.LastTimestamp)
|
||||||
result.LastTimestamp, result.LastTimestamp.Unix()))
|
|
||||||
return result.Error
|
return result.Error
|
||||||
}
|
}
|
||||||
fmt.Println(i18n.Tr("Imported %v of %v %s into %v.",
|
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() {
|
if result.LastTimestamp.Unix() < oldTimestamp.Unix() {
|
||||||
result.LastTimestamp = oldTimestamp
|
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)
|
err := c.db.SetImportTimestamp(c.sourceName, c.targetName, c.entity, result.LastTimestamp)
|
||||||
return err
|
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