~CODE SNIPPET BY DAVID, from XIAIX.COM Here's something I wrote about 3 years ago (2007). I got tired of how most CircleMUD codebases displayed everything in seconds. Using the below function will convert your affection->duration in seconds into the proper days/hours/minutes/seconds. This was originally geared towards a player that had roundtime for performing a certain action, but the math and 99% of the code below can be altered for whatever reason you want. To put it in use, add the following statement in any of your functions: ********* if (displayRoundtime(ch) == 0) return; ********* --------------------------------- ** [displayRoundtime] function ** --------------------------------- int displayRoundtime(struct char_data *ch) { struct affected_type *af; // In Roundtime? if ((AFF_FLAGGED(ch, AFF_ROUNDTIME))) { af = ch->affected; if (af->duration >= 1) { if (af->duration >= 86400) // 1 day or more? { int days; days = ((af->duration / 60) / 60) / 24; int hours, hours_2; hours = ((af->duration / 60) / 60) - (days * 24); hours_2 = ((af->duration / 60) / 60); int minutes; minutes = (af->duration / 60) - (hours_2 * 60); int seconds; seconds = af->duration - (((hours_2 * 60) * 60) + (minutes * 60)); if (hours == 0 && minutes == 0 && seconds == 0) send_to_char("...wait %d day%s.\r\n", days, days > 1 ? "s":""); else if (hours == 0 && minutes == 0 && seconds > 0) send_to_char("...wait %d day%s, %d second%s.\r\n", days, days > 1 ? "s":"", seconds, seconds > 1 ? "s":""); else if (hours == 0 && minutes > 0 && seconds == 0) send_to_char("...wait %d day%s, %d minute%s.\r\n", days, days > 1 ? "s":"", minutes, minutes > 1 ? "s":""); else if (hours == 0 && minutes > 0 && seconds > 0) send_to_char("...wait %d day%s, %d minute%s, %d second%s.\r\n", days, days > 1 ? "s":"", minutes, minutes > 1 ? "s":"", seconds, seconds > 1 ? "s":""); else if (hours > 0 && minutes == 0 && seconds == 0) send_to_char("...wait %d day%s, %d hour%s.\r\n", days, days > 1 ? "s":"", hours, hours > 1 ? "s":""); else if (hours > 0 && minutes == 0 && seconds > 0) send_to_char("...wait %d day%s, %d hour%s, %d second%s.\r\n", days, days > 1 ? "s":"", hours, hours > 1 ? "s":"", seconds, seconds > 1 ? "s":""); else if (hours > 0 && minutes > 0 && seconds == 0) send_to_char("...wait %d day%s, %d hour%s, %d minute%s.\r\n", days, days > 1 ? "s":"", hours, hours > 1 ? "s":"", minutes, minutes > 1 ? "s":""); else send_to_char("...wait %d day%s, %d hour%s, %d minute%s, %d second%s.\r\n", days, days > 1 ? "s":"", hours, hours > 1 ? "s":"", minutes, minutes > 1 ? "s":"", seconds, seconds > 1 ? "s":""); return (0); } else if (af->duration >= 3600 && af->duration < 86400) // 1 hour or more? { int hours; hours = (af->duration / 60) / 60; int minutes; minutes = (af->duration / 60) - (hours * 60); int seconds; seconds = af->duration - (((hours * 60) * 60) + (minutes * 60)); if (minutes == 0 && seconds == 0) send_to_char("...wait %d hour%s.\r\n", hours, hours > 1 ? "s":""); else if (minutes == 0 && seconds > 0) send_to_char("...wait %d hour%s, %d second%s.\r\n", hours, hours > 1 ? "s":"", seconds, seconds > 1 ? "s":""); else if (minutes > 0 && seconds == 0) send_to_char("...wait %d hour%s, %d minute%s.\r\n", hours, hours > 1 ? "s":"", minutes, minutes > 1 ? "s":""); else send_to_char("...wait %d hour%s, %d minute%s, %d second%s.\r\n", hours, hours > 1 ? "s":"", minutes, minutes > 1 ? "s":"", seconds, seconds > 1 ? "s":""); return (0); } else if (af->duration > 60 && af->duration < 3600) // 1 minute or more { int minutes; minutes = af->duration / 60; int seconds; seconds = af->duration - (minutes * 60); if (minutes > 1 && seconds > 1) send_to_char("...wait %d minutes, %d seconds.\r\n", minutes, seconds); else if (minutes > 1 && seconds == 1) send_to_char("...wait %d minutes, %d second.\r\n", minutes, seconds); else if (minutes > 1 && seconds == 0) send_to_char("...wait %d minutes.\r\n", minutes); else send_to_char("...wait %d minute, %d seconds.\r\n", minutes, seconds); return (0); } else { if (af->duration > 1) send_to_char("...wait %d seconds.\r\n", af->duration); else send_to_char("...wait 1 second.\r\n"); return (0); } return (0); } else { return (1); } } return (1); } --------- ********* ---------