The problem is that ctime() uses an internal allocated char array, which changes each time ctime() called.
Another problem is that your ctime() can be evaluated in any order in this expression. So what is happening here is that both of them on line 6 are evaluated, but obviously the second is rated second. Then the operators are applied from left to right, but both calls to ctime have already been evaluated, the rest from the left were made later, and now both lines refer to the same thing.
If you put them on different lines, you get the expected behavior.
http://www.cplusplus.com/reference/ctime/ctime/
C-string containing date and time information in a human-readable format.
The return value indicates an internal array whose validity period can be changed by any subsequent call to asctime or ctime.
source share