Excuse my ignorance, but I ran into a problem that turned out to be challenging for my current knowledge in programming with Processing, even though the idea is quite simple
You could store the last number of seconds in a static (or global) variable, and only increment i when the current number of seconds is higher than the oldsecs
void draw() {
static int oldsecs = 0;
int secs = millis() / 1000;
if (secs > oldsecs) {
i++;
oldsecs = secs;
}
...
Assuming the language is C, and the int type is not overflowed by the number of seconds.