Round times to minutes for i3status
This commit is contained in:
		
							
								
								
									
										12
									
								
								timer_ops.go
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								timer_ops.go
									
									
									
									
									
								
							| @@ -18,11 +18,19 @@ func (a *AppState) opI3Status(args []string) int { | ||||
| 		return 0 | ||||
| 	} | ||||
|  | ||||
| 	// TODO: Get Weekly/Daily totals | ||||
| 	var text string | ||||
| 	if wrk.Finished { | ||||
| 		text = fmt.Sprint(wrk.Duration().Round(time.Minute * 15)) | ||||
| 		wrkDur := wrk.Duration().Round(time.Minute * 15) | ||||
| 		hrs := int(wrkDur.Hours()) | ||||
| 		mins := int(wrkDur.Minutes()) - hrs*60 | ||||
| 		if hrs > 0 { | ||||
| 			text = fmt.Sprintf("%dh%dm", hrs, mins) | ||||
| 		} else { | ||||
| 			text = fmt.Sprintf("%d", mins) | ||||
| 		} | ||||
| 	} else { | ||||
| 		text = fmt.Sprint(wrk.Duration().Round(time.Second)) | ||||
| 		text = fmt.Sprint(wrk.Duration().Round(time.Minute)) | ||||
| 		// If the current time is before 7AM, after 5PM, or a weekend, use a Warning state | ||||
| 		cTime := time.Now() | ||||
| 		if cTime.Weekday() == time.Sunday || cTime.Weekday() == time.Saturday || cTime.Hour() < 7 || cTime.Hour() > 17 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user