docstore/pkg/core/helper.go
2021-02-18 22:52:36 +01:00

33 lines
498 B
Go

// Copyright (C) 2021 Marius Schellenberger
package core
import (
"sync"
"time"
)
const (
fileFmt = "20060102_150405"
logFmt = "2006/01/02 15:04:05: "
createdFmt = "02.01.2006 15:04:05"
)
var m sync.Mutex
func FileName() string {
m.Lock()
defer func() {
time.Sleep(time.Millisecond * 1100)
m.Unlock()
}()
return time.Now().Format(fileFmt)
}
func LogTime() string {
return time.Now().Format(logFmt)
}
func CreatedTime(t time.Time) string {
return t.Format(createdFmt)
}