Skip to content

Commit

Permalink
Show new deltaT (useful to catch skewed timer)
Browse files Browse the repository at this point in the history
  • Loading branch information
Simone Lazzaris committed Jan 10, 2019
1 parent a373586 commit 5cab497
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions polka.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func policy_verify(xdata connData, db *sql.DB) string {
if (*xdebug) { fmt.Println("DECODED: ",fmax, fquota, last_ts) }
}
now=time.Now().Unix()
if (*xdebug) { fmt.Println("DeltaT: ",(now-last_ts)) }
fquota=math.Max(0.0,fquota-(float64(now-last_ts)*fmax/3600.0)+1.0)
if (*xdebug) { fmt.Println("NEW QUOTA: ", fquota) }
if fquota>fmax {
Expand Down

0 comments on commit 5cab497

Please sign in to comment.