core/smn_core.cpp
changeset 1037 86af3790fcb7
parent 1011 b413072540fd
child 1041 f7b2073013df
     1.1 --- a/core/smn_core.cpp	Tue Jul 03 20:46:17 2007 +0000
     1.2 +++ b/core/smn_core.cpp	Wed Jul 04 11:09:48 2007 +0000
     1.3 @@ -83,6 +83,18 @@
     1.4  	return static_cast<cell_t>(t);
     1.5  }
     1.6  
     1.7 +static cell_t FormatTime(IPluginContext *pContext, const cell_t *params)
     1.8 +{
     1.9 +	char *format, *buffer;
    1.10 +	pContext->LocalToString(params[1], &buffer);
    1.11 +	pContext->LocalToString(params[3], &format);
    1.12 +
    1.13 +	time_t t = time(NULL);
    1.14 +	strftime(buffer, params[2], format, localtime(&t));
    1.15 +
    1.16 +	return 1;
    1.17 +}
    1.18 +
    1.19  static cell_t GetPluginIterator(IPluginContext *pContext, const cell_t *params)
    1.20  {
    1.21  	IPluginIterator *iter = g_PluginSys.GetPluginIterator();
    1.22 @@ -332,5 +344,6 @@
    1.23  	{"ReadPlugin",			ReadPlugin},
    1.24  	{"ThrowError",			ThrowError},
    1.25  	{"SetFailState",		SetFailState},
    1.26 +	{"FormatTime",			FormatTime},
    1.27  	{NULL,					NULL},
    1.28  };