mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	Display current stopwatch in navbar (#14122)
* add notification about running stopwatch to header * serialize seconds, duration in stopwatches api * ajax update stopwatch i should get my testenv working locally... * new variant: hover dialog * noscript compatibility * js: live-update stopwatch time * js live update robustness
This commit is contained in:
		@@ -19,6 +19,16 @@ type Stopwatch struct {
 | 
			
		||||
	CreatedUnix timeutil.TimeStamp `xorm:"created"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Seconds returns the amount of time passed since creation, based on local server time
 | 
			
		||||
func (s Stopwatch) Seconds() int64 {
 | 
			
		||||
	return int64(timeutil.TimeStampNow() - s.CreatedUnix)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Duration returns a human-readable duration string based on local server time
 | 
			
		||||
func (s Stopwatch) Duration() string {
 | 
			
		||||
	return SecToTime(s.Seconds())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getStopwatch(e Engine, userID, issueID int64) (sw *Stopwatch, exists bool, err error) {
 | 
			
		||||
	sw = new(Stopwatch)
 | 
			
		||||
	exists, err = e.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user