As per our discussion, I recommend looking at wtmp, either by calling "who -m" or the corresponding libc functions (getutent, etc, see "man wtmp").
As per our discussion, I recommend looking at wtmp, either by calling "who -m" or the corresponding libc functions (getutent, etc, see "man wtmp").