added amb449
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401043
This commit is contained in:
parent
d5dbffc6ab
commit
b80d04ba01
@ -83,6 +83,18 @@ static cell_t GetTime(IPluginContext *pContext, const cell_t *params)
|
||||
return static_cast<cell_t>(t);
|
||||
}
|
||||
|
||||
static cell_t FormatTime(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *format, *buffer;
|
||||
pContext->LocalToString(params[1], &buffer);
|
||||
pContext->LocalToString(params[3], &format);
|
||||
|
||||
time_t t = time(NULL);
|
||||
strftime(buffer, params[2], format, localtime(&t));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t GetPluginIterator(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
|
||||
@ -332,5 +344,6 @@ REGISTER_NATIVES(coreNatives)
|
||||
{"ReadPlugin", ReadPlugin},
|
||||
{"ThrowError", ThrowError},
|
||||
{"SetFailState", SetFailState},
|
||||
{"FormatTime", FormatTime},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
@ -264,6 +264,16 @@ native LogError(const String:format[], any:...);
|
||||
*/
|
||||
native GetTime(bigStamp[2]={0,0});
|
||||
|
||||
/**
|
||||
* Format date and time.
|
||||
*
|
||||
* @param buffer Destination string buffer.
|
||||
* @param maxlength Maximum length of output string buffer.
|
||||
* @param format Formatting rules.
|
||||
* @noreturn
|
||||
*/
|
||||
native FormatTime(String:buffer[], maxlength, const String:format[]);
|
||||
|
||||
/**
|
||||
* Loads a game config file.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user