I have a feeling this may be related to C syntax, but I started my programming life with C++ so I am not sure.
Basically I have seen this:
struct tm t;
memset( &t, 0, sizeof(struct tm) );
I am a bit confused with this syntax, as normally I would expect the above to instead look like this:
tm t;
memset( &t, 0, sizeof(tm) );
What is the difference between the two, and why is the former used instead?
Update
The structure tm
that I am referring to is in wchar.h
, and the definition is as follows:
struct tm {
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday - [0,6] */
int tm_yday; /* days since January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */
};