Hi, has anyone a script which fetch the Sosarian date, maybe given in input the systime?
Hi mean function UODate(input) -> "23 Misericordia 523"
Convert real date to Sosarian one?
Moderator: POL Developer
Re: Convert real date to Sosarian one?
Up
I found the instructions (http://uo.stratics.com/content/basics/datetime.shtml), I'm just too lazy
I found the instructions (http://uo.stratics.com/content/basics/datetime.shtml), I'm just too lazy
Re: Convert real date to Sosarian one?
sloppy script, it worked when I used it and seemed to sync up well with that page you linked.. but I can't guarantee it'll be 100% accurate...
from tests on this script, there is no possible way UO was released in 289... it had to be in 314 because 289 is somewhere back in 1993 from every calculation I did...
from tests on this script, there is no possible way UO was released in 289... it had to be in 314 because 289 is somewhere back in 1993 from every calculation I did...
Code: Select all
function GetSosariaTimeDate(who, time := 0)
var monthname:={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
var seconds := polcore().systime + 3600;
if (time)
seconds := time;
endif
var day := (seconds/7200) + 153525; // Sosaria's time started before UNIX but don't add it to systime because its a signed int and will go negative :-)
var month := 1 + (day/73);
var year := month/12;
month := month%12;
day := day%73;
if (!day)
month := month - 1;
day := 73;
endif
if (month == -1)
month := 12;
year := year - 1;
elseif (month == 0)
month := 1;
endif
if (day == 0)
day := 1;
endif
var currenttime := (seconds%7200) * 12;
var hours := currenttime/3600;
if (hours < 10)
hours := "0" + CStr(hours);
endif
var minutes := (currenttime%3600)/60;
if (minutes < 10)
minutes := "0" + CStr(minutes);
endif
seconds := (currenttime%3600)%60;
if (seconds < 10)
seconds := "0" + CStr(seconds);
endif
SendSysMessage(who, CStr(monthname[month]) + " " + CStr(day) + ", " + CStr(year));
SendSysMessage(who, CStr(hours) + ":" + CStr(minutes) + ":" + CStr(seconds));
endfunction