[Turn on line numbering]arg time, @reftime; var times, words, x, ctime, mnths, month, year, days, out, lt, rrk; // most of this was stolen from MOO (und ve are evil) if (time < 1) return "0 seconds"; [(reftime ?= time())] = reftime; words = ["year", "month", "day", "hour", "minute", "second"]; times = []; for x in ([60, 60, 24]) { times = [time % x, @times]; time = time / x; } mnths = 0; lt = localtime(reftime); month = lt[6]; if (lt[7] < 100) year = 1900 + lt[7]; else year = lt[7]; days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; while (time >= days + (month == 2 && year % 4 == 0 && !(year % 400 in [100, 200, 300]))) { refresh(); time -= days; mnths++; month++; if (month > 12) { year++; month = 1; } } times = [mnths / 12, mnths % 12, time, @times]; out = []; for x in [1 .. 6] { if (times[x] > 0) out += [times[x] + " " + words[x] + (times[x] == 1 ? "" : "s")]; } return out.to_english();
// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit