Time #112
Aliases: Time
15 verbs · 20 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
time | this none this | rxd | #112 | 8 |
ctime | this none this | rxd | #112 | 11 |
_heartbeat | this none this | rxd | #112 | 4 |
day_segment | this none this | rxd | #112 | 16 |
is_later_than is_earlier_than | this none this | rxd | #112 | 7 |
short_duration | this none this | rxd | #112 | 10 |
ctime_short | this none this | rxd | #112 | 24 |
duration | this none this | rxd | #112 | 17 |
game_duration | this none this | rxd | #112 | 3 |
holiday_today | this none this | rxd | #112 | 8 |
day_minutes | this none this | rxd | #112 | 5 |
ampm | this none this | rxd | #112 | 18 |
month | this none this | rxd | #112 | 4 |
moon_phase | this none this | rxd | #112 | 25 |
day_segment_named | this none this | rxd | #112 | 1 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
heartbeat_interval | #112 | rc | #361 | 450 |
heartbeat_task | #112 | rc | #361 | 0 |
help_msg | #112 | rc | #361 | list of 5{"Game time runs 8 times faster than realtime -- for each real-life day, 8 days will pass in the game.", "", "$time:time() -> Return seconds-since-epoch.", "$time:ctime() -> Return string description of the current time or a given seconds-since-epoch time.", "$time:day_segment() -> Return current day segment (dawn/morning/day/evening/dusk/night) for room descriptions and other purposes."} |
day_segments | #112 | rc | #361 | {"dawn", "morning", "day", "evening", "dusk", "night"} |
holidays | #112 | rc | #361 | list of 8{{"Xmas eve", "Dec 24"}, {"Xmas day", "Dec 25"}, {"New Year's eve", "Dec 31"}, {"New Year's day", "Jan 1"}, {"Suicide Day", "May 1"}, {"Armageddon Day", "Sep 11"}, {"Abortion Day", "Aug 18"}, {"Feast of all Clones", "Feb 21"}} |
generic_holiday | #112 | rc | #361 | #122240 |
months | #112 | rc | #361 | list of 12{"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} |
months_short | #112 | rc | #361 | list of 12{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"} |
moon_phases | #112 | rc | #361 | list of 8{{4, "full", "The full moon shines down brightly."}, {7, "waning gibbous", "The waning gibbous moon shines down."}, {10, "last quarter", "The last quarter moon shines in the night sky."}, {13, "waning crescent", "A sliver of waning crescent moon hangs in the night sky."}, {17, "new", "The black disc of the new moon hangs like a hole in the night sky."}, {20, "waxing crescent", "A sliver of waxing crescent moon hangs in the night sky."}, {25, "first quarter", "The first quarter moon shines in the night sky."}, {30, "waxing gibbous", "The waxing gibbous moon shines brightly in the night sky."}} |
offset | #112 | rc | #361 | 0 |
aliases | #1 | rc | #361 | {"Time"} |
description | #1 | rc | #361 | "A utility object that keeps track of game time." |
object_size | #1 | r | #29 | {10538, 1298433815} |
hidden_verbs | #1 | rc | #361 | <clear> |
phelp_msg | #1 | rc | #361 | <clear> |
weight | #1 | rc | #361 | <clear> |
owner_verbs | #1 | rc | #361 | <clear> |
plural_name | #1 | rc | #361 | <clear> |
client_image | #1 | rc | #361 | <clear> |
listening | #1 | rc | #361 | <clear> |
Ancestry
Ancestors (nearest first): #1 root
Children: none
Call graph
Source
time
Referenced by
- #6:@age line 39:
$time:time - #100:birthday line 12:
$time:time - #112:ctime line 3:
this:time - #112:day_segment line 4:
this:time - #112:ctime_short line 3:
this:time - #112:month line 1:
this:time - #167:record_shop_log_entry line 5:
$time:time - #167:summary line 6:
$time:time
Source
1":time()"; 2"Return INT number of game-seconds since epoch."; 3if (args) 4time = args[1]; 5else 6time = time(); 7endif 8return ((time - 1200000000) * 8) + this.offset;
ctime
Referenced by
- #6:@age line 39:
$time:ctime - #100:time line 34:
$time:ctime - #100:time line 39:
$time:ctime - #100:time line 41:
$time:ctime - #100:birthday line 12:
$time:ctime - #112:day_segment line 5:
this:ctime - #112:is_later_than line 5:
this:ctime - #112:holiday_today line 1:
this:ctime - #112:day_minutes line 2:
this:ctime - #112:month line 2:
this:ctime - #112:moon_phase line 2:
$time:ctime - #130:look_self line 2:
$time:ctime - #130:alarm_check line 1:
$time:ctime - #167:log line 2:
$time:ctime - #167:summary line 6:
$time:ctime - #167:biz_shoplog line 8:
$time:ctime
Source
1":ctime([INT time])"; 2"Return string describing the time."; 3time = args ? args[1] | this:time(); 4ctime = ctime(time); 5"century = toint(ctime[21..22]);"; 6"century = century + 1;"; 7"ctime[21..22] = tostr(century);"; 8year = toint(ctime[21..24]); 9year = year + 152; 10ctime[21..24] = tostr(year); 11return ctime[1..24];
_heartbeat
Referenced by
- #112:_heartbeat line 2:
this:_heartbeat
Source
1fork task_id (this.heartbeat_interval) 2this:_heartbeat(); 3endfork 4this.heartbeat_task = task_id;
day_segment
Referenced by
- #3:time_msg line 1:
$time:day_segment - #3:time_windows_msg line 2:
$time:day_segment - #3:look_sky line 16:
$time:day_segment - #3:tell_map_backup line 31:
$time:day_segment - #3:darkness_old line 8:
$time:day_segment - #3:_darkness line 8:
$time:day_segment - #100:time line 9:
$time:day_segment - #100:time line 34:
$time:day_segment - #112:day_segment_named line 1:
this:day_segment - #114:time_windows_msg line 2:
$time:day_segment - #130:look_self line 2:
$time:day_segment - #240:can_ambience line 2:
$time:day_segment - #257:_darkness line 4:
$time:day_segment - #258:_darkness line 8:
$time:day_segment
Source
1":day_segment([INT time])"; 2"Return ordinal day segment, for room descriptions and other purposes."; 3"1=dawn, 2=morning, 3=day, 4=evening, 5=dusk, 6=night"; 4time = args ? args[1] | this:time(); 5hour = toint((ctime = this:ctime(time))[12..13]); 6month = ctime[5..7] in this.months_short; 7if (hour < 10) 8morning = {-2, -1, 0, 0, 0, 1, 1, 1, 0, 0, -1, -1}[month]; 9hour = hour + morning; 10elseif (hour > 12) 11evening = {2, 1, 0, 0, -1, -2, -2, 1, 0, 0, 1, 1}[month]; 12hour = hour + evening; 13endif 14hour = hour + 1; 15hour = max(1, min(hour, 24)); 16return {6, 6, 6, 6, 6, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6}[hour];
is_later_than is_earlier_than
Referenced by
none
Source
1":is_later_than(STR time)"; 2"Given a string of the form hh:mm, return number-of-seconds-later if the current time is later than that."; 3dtime = args[1]; 4dtimei = (toint(args[1][1..2]) * 60) + toint(args[1][4..5]); 5now = this:ctime(); 6nowi = (toint(now[12..13]) * 60) + toint(now[15..16]); 7return (verb[4] == "l") ? max(0, nowi - dtimei) | max(0, dtimei - nowi);
short_duration
Referenced by
- #318:_who line 120:
$time:short_duration
Source
1sec = args[1]; 2if (sec < 60) 3return tostr(sec) + "s"; 4elseif (sec < (60 * 60)) 5return tostr(sec / 60) + "m"; 6elseif (sec < ((60 * 60) * 24)) 7return tostr(sec / (60 * 60)) + "h"; 8else 9return tostr(sec / ((60 * 60) * 24)) + "d"; 10endif
ctime_short
Referenced by
- #3:title line 28:
$time:ctime_short
Source
1":ctime([INT time])"; 2"Return string describing the time."; 3time = args ? args[1] | this:time(); 4ctime = ctime(time); 5ctime = ctime[12..16]; 6hour = toint(ctime[1..2]); 7min = ctime[4..5]; 8if (hour > 12) 9hour = hour - 12; 10ampm = "pm"; 11elseif (hour == 12) 12ampm = "pm"; 13else 14ampm = "am"; 15endif 16if (hour == 0) 17hour = 12; 18endif 19ctime = ($ansi.bold_on + $ansi.white) + tostr(hour); 20ctime = ctime + ":"; 21ctime = ((ctime + $ansi.white) + $ansi.bold_on) + min; 22ctime = (ctime + $ansi.bold_off) + ampm; 23ctime = ctime + $ansi.reset; 24return ctime;
duration
Referenced by
- #6:cool*downs line 6:
$time:duration - #6:ip_daily line 6:
$time:duration - #107:cooldown_check line 25:
$time:duration - #112:game_duration line 3:
this:duration - #130:_do_check line 14:
$time:duration - #167:_old_takeover line 12:
$time:duration - #214:inspect line 5:
$time:duration - #214:inspect line 6:
$time:duration - #214:inspect line 7:
$time:duration - #306:look_self line 1:
$time:duration
Source
1{sec, ?long = 0} = args; 2if (sec < 60) 3s = (sec > 1) ? "s" | ""; 4return (tostr(sec) + (long ? " second" | " sec")) + s; 5elseif (sec < (60 * 60)) 6m = sec / 60; 7s = (m > 1) ? "s" | ""; 8return (tostr(m) + (long ? " minute" | " min")) + s; 9elseif (sec < ((60 * 60) * 24)) 10h = sec / (60 * 60); 11s = (h > 1) ? "s" | ""; 12return (tostr(h) + (long ? " hour" | " hr")) + s; 13else 14d = sec / ((60 * 60) * 24); 15s = (d > 1) ? "s" | ""; 16return (tostr(d) + " day") + s; 17endif
game_duration
Referenced by
Source
1"Text desc of how long 'duration' is in game-time, assuming 'duration' is real-time seconds."; 2dur = args[1]; 3return this:duration(dur * 8);
holiday_today
Referenced by
- #100:time line 35:
$time:holiday_today - #130:look_self line 17:
$time:holiday_today
Source
1ctime = args ? args[1] | this:ctime(); 2cday = ctime[5..10]; 3for x in ($ou:leaves(this.generic_holiday)) 4if (x.day == cday) 5return x; 6endif 7endfor 8return #-1;
day_minutes
Referenced by
none
Source
1"Return number of minutes passed in this game day so far."; 2time = args ? args[1] | this:ctime()[12..16]; 3hour = tonum(time[1..2]); 4min = tonum(time[4..5]); 5return (hour * 60) + min;
ampm
Referenced by
none
Source
1ct = args[1]; 2hours = tonum(ct[1..2]); 3min = tonum(ct[4..5]); 4if (hours < 12) 5ap = "am"; 6if (hours < 1) 7hours = 12; 8endif 9else 10ap = "pm"; 11if (hours > 12) 12hours = hours - 12; 13endif 14endif 15if (min < 10) 16min = "0" + tostr(min); 17endif 18return ((tostr(hours) + ":") + tostr(min)) + ap;
month
Referenced by
none
Source
1time = args ? args[1] | this:time(); 2ctime = this:ctime(time)[5..7]; 3ctime = ctime in {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; 4return ctime;
moon_phase
Referenced by
- #3:look_sky line 17:
$time:moon_phase - #3:darkness_old line 7:
$time:moon_phase - #257:_darkness line 8:
$time:moon_phase
Source
1return_type = args ? args[1] | 1; 2ctime = $time:ctime(); 3year = toint(ctime[23..24]); 4a1 = year % 19; 5if (a1 > 9) 6a1 = a1 - 9; 7endif 8a2 = $au:mod(a1 * 11, 30); 9day = toint(ctime[9..10]); 10phase = a2 + day; 11month = ctime[5..7] in this.months_short; 12if (month < 3) 13month = month + 2; 14endif 15phase = (phase + month) - 4; 16phase = phase % 30; 17if (return_type == 1) 18return phase; 19else 20for x in (this.moon_phases) 21if (phase <= x[1]) 22return x[return_type]; 23endif 24endfor 25endif
day_segment_named
Referenced by
none
Source
1return this.day_segments[this:day_segment()];