SA-MP Forums Archive
There is a way to get the real date and time? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: There is a way to get the real date and time? (/showthread.php?tid=323059)



There is a way to get the real date and time? - tal_peretz - 04.03.2012

I want to get the real date and time in my country but not with gettime and getdate... there is and includ or plugin?

Thanks


Re: There is a way to get the real date and time? - tal_peretz - 04.03.2012

Anyone know ?


Re: There is a way to get the real date and time? - Abreezy - 04.03.2012

Whats wrong with GetTime and GetDate?


Re: There is a way to get the real date and time? - Twisted_Insane - 04.03.2012

Why you wanna use a plugin or a FS for nothing? If you'll use "gettime - getdate", it will automatically receive the info from the time of YOUR country! ^^
If you want it for a command, just post it here and I'mma combine it with the date / time for you!


Re: There is a way to get the real date and time? - tal_peretz - 04.03.2012

I have a reason that I want it .. it takes the time and the date of my computer/the linux, not the real time.


Re: There is a way to get the real date and time? - Twisted_Insane - 04.03.2012

Huh, what? Then switch the time of your PC (Linux, which is one of the strongest OS' ever) to the realtime of your country?


Re: There is a way to get the real date and time? - jameskmonger - 04.03.2012

pawn Код:
stock getRealTime(&hr, &min, &sec, timeDiff) {
     new Hour, Minute, Second;
     gettime(Hour, Minute, Second);
     hr = (Hour + timeDiff);
     min = Minute;
     sec = Second;
}
Usage:
If you are 1 hour behind the host, use "getRealTime(hourvariable, minutevariable, secondvariable, -1)". If you are 3 hours ahead of the host, use "getRealTime(hourvariable, minutevariable, secondvariable, 3)". If you are 8 hours behind the hose, use "getRealTime(hourvariable, minutevariable, secondvariable, -". It follows the same pattern as gettime so use it like this:
pawn Код:
new Hour, Minute, Sec;
getRealTime(Hour, Minute, Sec, -1);
printf("%d | %d | %d", Hour, Minute, Sec);



Re: There is a way to get the real date and time? - Twisted_Insane - 04.03.2012

Yep, that's also a good way, if you're for example 2 hours behind, it would look like this:

pawn Код:
getRealTime(Hour, Minute, Sec, -2);
The simple explanation would look like this:

pawn Код:
getRealTime(Hour, Minute, Sec, -AMOUNT_OF_TIME_BEHIND);



Re: There is a way to get the real date and time? - jameskmonger - 04.03.2012

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
The simple explanation would look like this:

pawn Код:
getRealTime(Hour, Minute, Sec, -AMOUNT_OF_TIME_BEHIND);
pawn Код:
getRealTime(Hour, Minute, Sec, DIFFERENCE_IN_HOURS);



Re: There is a way to get the real date and time? - tal_peretz - 04.03.2012

I want to make defender to my mode I need the real time and date only [i'ts complicated], maybe car I use HTTP? Do you sure that there are not plugin for that?