mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-23 09:04:03 +09:00
feat: calculate duration
This commit is contained in:
@ -75,15 +75,8 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func (task *ActionTask) TakeTime() time.Duration {
|
||||
if task.Started == 0 {
|
||||
return 0
|
||||
}
|
||||
started := task.Started.AsTime()
|
||||
if task.Status.IsDone() {
|
||||
return task.Stopped.AsTime().Sub(started)
|
||||
}
|
||||
return time.Since(started).Truncate(time.Second)
|
||||
func (task *ActionTask) Duration() time.Duration {
|
||||
return calculateDuration(task.Started, task.Stopped, task.Status)
|
||||
}
|
||||
|
||||
func (task *ActionTask) IsStopped() bool {
|
||||
|
Reference in New Issue
Block a user