Synchronize time [Solved]

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
pacefist
Posts: 8
Joined: Tue Dec 07, 2010 9:10 pm

Synchronize time [Solved]

Post by pacefist »

L2J Revision Number:4425
L2JDP Revision Number:7669
Hi everybody! I really dunno where put this top and if it it's not right place, i give u my apologise! Ok! Here we go!
My question is that, that i want to know is it possible to synchronize real time and in-game time. I think that the formula in GameTimeController but i dunno how to change it. Can somebody help me?
Thnx in adnvance!
Last edited by pacefist on Thu Dec 09, 2010 9:41 am, edited 1 time in total.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Synchronize real time and in-game tim

Post by jurchiks »

well, that's the problem. supposedly the server synchronises with java runtime and that in turn with the system it runs on, but that doesn't work so well. On one server I help out sometimes the delay is +6 hours but the regional and time settings are 100% correct.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
pacefist
Posts: 8
Joined: Tue Dec 07, 2010 9:10 pm

Re: Synchronize real time and in-game tim

Post by pacefist »

Really problem...Maybe i'll try to change my request. I want to do like this: when it's night in real world - it's also night in game world. Like this! And one more point: if it's not possible to sync time, maybe it's posssibe to make time run in game equally real time. (like 12 hours for night and 12 hours for day).
Thnx in advance!
Some adds: We can use Calendar.class to define hours and minutes and then count down from this point of time in GameTimeController. But i dunno how to do this...I'm not so powerful in Java yet :(
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: Synchronize real time and in-game tim

Post by JIV »

in past we used some packet to set client minute time interval, but its not used now and not sure if still work. But its not the right thing to mix gametime and realtime since gametime does not depend on real. Its running in own thread and it can get delayed (and it will), thats why we use (mostly like we should but we not to) gametime for ingame stuff.
pacefist
Posts: 8
Joined: Tue Dec 07, 2010 9:10 pm

Re: Synchronize real time and in-game tim

Post by pacefist »

I did some staff, but i didnt know why as i enter the game sky's color didnt change...

Code: Select all

     class BroadcastSunState implements Runnable    {        public void run()        {            Date date = new Date();            @SuppressWarnings("deprecation")            int h = date.getHours();            L2GameServerPacket packet = null;                if ((h>=7) && (h<10))                 {                    packet = new SignsSky(2); //dawn                    System.out.println("DayNightSpawnManager: Dawn started at " + date + "");                }                else if ((h>=10) && (h<19))                {                    packet = new SunRise(); //day                    System.out.println("DayNightSpawnManager: Day started at " + date + "");                }                else if ((h>=19) && (h<22))                {                    packet = new SignsSky(1); //dusk                    System.out.println("DayNightSpawnManager: Dusk started at " + date + "");                }                else                {                    packet = new SunSet(); //night                      System.out.println("DayNightSpawnManager: Night started at " + date + "");                }                if(packet != null)                    for (L2PcInstance player : L2World.getInstance().getAllPlayers())                        player.sendPacket(packet);                boolean tempIsNight = ((h>=10) && (h<19));                if (tempIsNight != _isNight)                 {                    _isNight = tempIsNight;                    DayNightSpawnManager.getInstance().notifyChangeMode();                }        }    } 

What's wrong with that?
Post Reply