Ah, that's what you meant. I used signed ints at all places in here, because struct tm uses signed ints, too.