Simplify timestamp comparisons

This commit is contained in:
Philipp Wolfer 2025-05-01 12:27:24 +02:00
parent 389c7c6ec1
commit c305b6c7e3
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
7 changed files with 14 additions and 14 deletions

View file

@ -123,7 +123,7 @@ func (c *TransferCmd[E, I, R]) Transfer(exp backends.ExportProcessor[R], imp bac
resultChan := make(chan models.ImportResult)
go imp.Process(exportChan, resultChan, importProgress)
result := <-resultChan
if result.LastTimestamp.Unix() < timestamp.Unix() {
if timestamp.After(result.LastTimestamp) {
result.LastTimestamp = timestamp
}
wg.Wait()
@ -180,7 +180,7 @@ func (c *TransferCmd[E, I, R]) timestamp() (time.Time, error) {
}
func (c *TransferCmd[E, I, R]) updateTimestamp(result models.ImportResult, oldTimestamp time.Time) error {
if result.LastTimestamp.Unix() < oldTimestamp.Unix() {
if oldTimestamp.After(result.LastTimestamp) {
result.LastTimestamp = oldTimestamp
}
printTimestamp("Latest timestamp: %v (%v)", result.LastTimestamp)