yet another day of converting
delay accounting python script into C