ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] Bug 5653 - Display "Day of Year" for January 1 as 1, not 0

From: Matthew Parris <parrisimo@xxxxxxxxx>
Date: Mon, 7 Feb 2011 07:52:30 -0500
I'd like some others to comment regarding this proposed change.  See Bug 5653.


In to_str.c, the abs_time_to_str and abs_time_secs_to_str functions creates a
string for display using gmtime.  This patch affects those using the
"ABSOLUTE_TIME_DOY_UTC" conversion case.

The tm_yday "Day of Year" parameter is defined by gmtime as "The number of days
since January 1, in the range 0 to 365"  so the tm_yday parameter equals zero
for January 1.  Similarly, the tm_year "Year" is defined as "The number of
years since 1900" so the tm_year parameter equals zero for 1900.

Within the abs_time_to_str function, 1900 is added to the tm_year parameter,
but 1 is not added to the tm_yday.  I'm used to seeing the day of the year
equal to 1 on January 1st.  Does anyone use 0 for January 1?