1) int secondsToday = tm.tm_hour*3600+tm.tm_min*60+tm.tm_sec; // for just the seconds so far today.
type of (long long) is an 64 bit integer, but printf looks like it is limited to a long integer and is wrapping on print giving a negative.
3) when you are sending a date over to a server, #2) accuracy would be important or the server will interpret as a different date and time.
an example when sending to a MySQL server, date is recorded by the string '2014-11-17 18:40:00' . The server will store it and be able to calculate differences between to dates and/or times. Most systems might be looking for a timestamp, but probably not in terms of seconds since year 0.
you might be creating more work for yourself (and extra routines to calculate the time differences etc) by putting it in terms of seconds.