[REL] mtime Time Plugin [UnixTime Convert, Regular Time Convert and more] -
Mellnik - 24.11.2012
THIS PROJECT IS OUTDATED AND NO LONGER MAINTAINED. DO NOT USE IT AS IT CONTAINS SECURITY VULNERABILITIES AND BUGS.
« mtime »
time plugin
v2.1
Author: Mellnik
Current Version: v2.1
Release Date: 24/11/2012
Information
This plugin provides different time functions and time convert methods.
At the moment, there are 4 natives, I will explain them below:
(If a parameter is written in italic - it is optional)
mtime_UnixToDate(dest[], unixseconds, date, timeformat);
Description:It simply converts UnixTime to a readable date.
By default date is set to DATE_LITTLEENDIAN and timeformat to CLOCK_EUROPEAN
There are three formats for the date and two for the clock format.
Код:
DATE_LITTLEENDIAN -> Day.Month.Year
DATE_BIGENDIAN -> Year.Month.Day
DATE_MIDDLEENDIAN -> Month.Day.Year
Calendar date - Wikipedia
Код:
CLOCK_EUROPEAN -> Hour in 24h format:Minute:Second
CLOCK_AMERICAN -> Hour in 12h format:Minute:Second (AM or PM designation)
Example:
Код:
new string[40];
mtime_UnixToDate(string, 1353777478);
print(string);
// Output: 24.11.2012 - 18:17:58
Another example:
Код:
new string[40];
mtime_UnixToDate(string, gettime(), DATE_MIDDLEENDIAN, CLOCK_AMERICAN); // gettime() returns current date in unixtime
print(string);
// Possible output: 11.24.2012 - 06:17:58 PM
mtime_ToRegularTime(dest[], msecs, bool:use_hrs);
Description:It converts milliseconds to hours:minutes:seconds:milliseconds.
Example
Код:
new string[45];
mtime_ToRegularTime(string, 38193856);
print(string);
// Output: 10:36:33.856
Код:
new string[45];
mtime_ToRegularTime(string, 381938, false);
print(string);
// Output: 06:21.938
mtime_GetLocalTime(dest[], date, timeformat);
Description:Gets localtime of the OS. See mtime_UnixToDate() for the date and timeformat params
Example:
Код:
new string[30];
mtime_GetLocalTime(string);
print(string);
// Possible output: 24.11.2012 - 18:44:41
Код:
new string[30];
mtime_GetLocalTime(string, DATE_MIDDLEENDIAN, CLOCK_AMERICAN);
print(string);
// Possible output: 11.24.2012 - 06:44:41 PM
mtime_GetServerUptime();
Description:Returns the uptime of the SAMP server in seconds.
Example:
Код:
new uptime = mtime_GetServerUptime();
// uptime is now equal to the elapsed seconds since the plugin has been loaded
Download:
http://files.mellnik.com/old/
Changelog:- v2.0 (03/08/2013)
- Moved to github
- Redesigned some natives
- Cleaned up and improved the code
- v1.1 (28/02/2013)
- Fixed mtime_GetServerUptime() for Linux
- Removed the type param in mtime_GetServerUptime()
- Re-managed the code
- Fixed -O in makefile
- Fixed several crashes due to buffer overflows
- Optimized some code
License:
mtime is licensed under
MPL 2.0
Re: mtime Time Plugin [UnixTime convert, Regular Time Convert and more] -
Niko_boy - 24.11.2012
this is rather a good start with c++ :O
Re: mtime Time Plugin [UnixTime convert, Regular Time Convert and more] -
TheArcher - 24.11.2012
I agree with what you said. Everything can be scriptable in PAWN, also C++ is faster than PAWN but however is not noticeable on this case. Good job anyways
Re: mtime Time Plugin [UnixTime convert, Regular Time Convert and more] -
Edvin - 24.11.2012
Very usefull plugin
Re: mtime Time Plugin [UnixTime convert, Regular Time Convert and more] -
AMEENAMEEN - 24.11.2012
Really nice ,thanks.
Re: mtime Time Plugin [UnixTime convert, Regular Time Convert and more] -
Bicentric - 02.12.2012
Thank you for creating this! This is just what I needed! Originally I was sending a HTTP request to a PHP script, then using the response, but this was slow, and this is the perfect solution!
Good work!
AW: Re: mtime Time Plugin [UnixTime convert, Regular Time Convert and more] -
Mellnik - 02.12.2012
Quote:
Originally Posted by Bicentric
Thank you for creating this! This is just what I needed! Originally I was sending a HTTP request to a PHP script, then using the response, but this was slow, and this is the perfect solution!
Good work!
|
NP
![Wink](images/smilies/wink.png)
But please report any bugs you may find.
Re: mtime Time Plugin [UnixTime convert, Regular Time Convert and more] -
Iceaac - 08.12.2012
Thank you for making this, very useful!
Respuesta: mtime Time Plugin [UnixTime convert, Regular Time Convert and more] -
[NVC]iTrevaS - 08.12.2012
Good job !
Re: mtime Time Plugin [UnixTime convert, Regular Time Convert and more] -
Michael@Belgium - 08.12.2012
Nice work, i could use this ! ^^