Page 1 of 1

Synchronize time [Solved]

Posted: Tue Dec 07, 2010 9:22 pm
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!

Re: Synchronize real time and in-game tim

Posted: Tue Dec 07, 2010 9:25 pm
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.

Re: Synchronize real time and in-game tim

Posted: Tue Dec 07, 2010 9:33 pm
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 :(

Re: Synchronize real time and in-game tim

Posted: Wed Dec 08, 2010 1:50 am
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.

Re: Synchronize real time and in-game tim

Posted: Wed Dec 08, 2010 10:58 am
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?