time.diff
D:/Sites/ryzom/time/functions_time.php Wed Jul 15 15:27:31 2009 | ||
---|---|---|
29 | 29 |
$time_in_hours = ($tick-RYTIME_TICK_OFFSET) / RYTIME_HOUR_TICKS; |
30 | 30 |
$day = $time_in_hours / RYTIME_DAY_HOURS; |
31 | 31 |
|
32 |
$out["jena_year"] = floor($day / RYTIME_JY_DAYS + RYTIME_START_JY); |
|
32 |
$out["jena_year"] = floor($day / RYTIME_JY_DAYS) + RYTIME_START_JY; |
|
33 |
if ($day < 0) $day = RYTIME_JY_DAYS - abs($day) % RYTIME_JY_DAYS; |
|
34 |
|
|
33 | 35 |
$out["day_of_jy"] = $day % RYTIME_JY_DAYS; |
34 | 36 |
$out["month_of_jy"] = floor($out["day_of_jy"] / RYTIME_MONTH_DAYS); |
35 | 37 |
|
... | ... | |
43 | 45 |
$out["season"] = ($day / RYTIME_SEASON_DAYS) % RYTIME_CYCLE_SEASONS; |
44 | 46 |
$out["day_of_season"] = $day % RYTIME_SEASON_DAYS; |
45 | 47 |
|
46 |
$out["time_of_day"] = $time_in_hours % RYTIME_DAY_HOURS; |
|
48 |
$out["time_of_day"] = abs($time_in_hours) % RYTIME_DAY_HOURS; |
|
49 |
if ($time_in_hours < 0 && $out["time_of_day"]) $out["time_of_day"] = RYTIME_DAY_HOURS - $out["time_of_day"]; |
|
50 |
|
|
47 | 51 |
$out["shardid"] = $shardid; |
52 |
|
|
48 | 53 |
return $out; |
49 | 54 |
} |
50 | 55 |
|
... | ... | |
62 | 67 |
*/ |
63 | 68 |
function ryzom_time_txt($rytime) { |
64 | 69 |
$RYTIME_MONTHS = |
65 |
array(0 => 'Winderly', 1 => 'Germinally', 2 => 'Folilally', 3 => 'Floris',
|
|
70 |
array(0 => 'Winderly', 1 => 'Germinally', 2 => 'Folially', 3 => 'Floris', |
|
66 | 71 |
4 => 'Medis', 5 => 'Thermis', 6 => 'Harvestor', 7 => 'Frutor', |
67 | 72 |
8 => 'Fallenor', 9 => 'Pluvia', 10 => 'Mystia', 11 => 'Nivia'); |
68 | 73 |
$RYTIME_DAYS = array(0 => 'Prima', 1 => 'Dua', 2 => 'Tria', |
69 | 74 |
3 => 'Quarta', 4 => 'Quinteth', 5 =>'Holeth'); |
70 | 75 |
|
71 | 76 |
# Day, Month DayOfMonth, CycleNth CA JY |
72 |
return sprintf("%sh - %s, %s %d, %de CA %d",
|
|
77 |
return sprintf("%sh - %s, %s %d, %d%s CA %d",
|
|
73 | 78 |
$rytime["time_of_day"], |
74 | 79 |
$RYTIME_DAYS[$rytime["day_of_week"]], |
75 | 80 |
$RYTIME_MONTHS[$rytime["month_of_cycle"]], |
76 | 81 |
$rytime["day_of_month"] + 1, |
77 | 82 |
$rytime["cycle"] + 1 /* 0-index */, |
83 |
$rytime["cycle"] ? 'e':'er', |
|
78 | 84 |
$rytime["jena_year"]); |
79 | 85 |
} |
80 | 86 |
|