Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cardinal and normal number options for seasons. #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ddate.1
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Abbreviated name of the day of the week (i.e., SM)
Full name of the season (i.e., Chaos)
.IP %b
Abbreviated name of the season (i.e., Chs)
.IP %u
Cardinal number of the season (i.e., 4)
.IP %U
Ordinal number of the season (i.e., 4th)
.IP %d
Cardinal number of day in season (i.e., 23)
.IP %e
Expand Down
2 changes: 2 additions & 0 deletions ddate.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ void format(char *buf, const char* fmt, struct disc_time dt)
case 'a': wibble=day_short[dt.yday%5]; break;
case 'B': wibble=season_long[dt.season]; break;
case 'b': wibble=season_short[dt.season]; break;
case 'u': sprintf(snarf, "%u", dt.season+1); wibble=snarf; break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"%d" instead of "%u" as per cases 'd' and 'e'? Don't need unsigned integer in this case, do we?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jep, season is a signed int.

case 'U': sprintf(snarf, "%u%s", dt.season+1, ending(dt.season+1)); wibble=snarf; break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

case 'd': sprintf(snarf, "%d", dt.day+1); wibble=snarf; break;
case 'e': sprintf(snarf, "%d%s", dt.day+1, ending(dt.day+1));
wibble=snarf; break;
Expand Down