From 2f006df7a6aff97bb69bb2b6ffd607890863ebf9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 10 Oct 2024 10:34:26 +0300 Subject: initial timestamp package --- internal/timestamp/timestamp_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 internal/timestamp/timestamp_test.go (limited to 'internal/timestamp/timestamp_test.go') diff --git a/internal/timestamp/timestamp_test.go b/internal/timestamp/timestamp_test.go new file mode 100644 index 0000000..27d0fd4 --- /dev/null +++ b/internal/timestamp/timestamp_test.go @@ -0,0 +1,23 @@ +package timestamp + +import ( + "strings" + "testing" + "time" +) + +func TestUpdateInFilename(t *testing.T) { + var ( + filePath = "gosdir/db/platforms/mastodon/1728240487.txt.20241009-232530.queued" + nowTime = time.Now() + updatedFilePath = UpdateInFilename(filePath, -2) + parts = strings.Split(updatedFilePath, ".") + ) + + updatedTime, err := Parse(parts[len(parts)-2]) + if err != nil { + t.Error(err) + } + + t.Log(filePath, updatedFilePath, nowTime.Sub(updatedTime)) +} -- cgit v1.2.3