added amb805, time formatting cvar

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401365
This commit is contained in:
Borja Ferrer 2007-08-19 16:54:06 +00:00
parent f6c7196408
commit 6a05c0925c
4 changed files with 16 additions and 3 deletions

View File

@ -26,6 +26,13 @@ sm_menu_sounds 1
// Default: 30
sm_vote_delay 30
// Default datetime formatting rules when displaying to clients.
// For full options, see: http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
// --
// Default: %m/%d/%Y - %H:%M:%S
// 12 hour format: %m/%d/%Y - %I:%M:%S %p
sm_datetime_format "%m/%d/%Y - %H:%M:%S"
// Specifies the amount of time that is allowed between chat messages. This
// includes the say and say_team commands. If a client sends a message faster
// than this time, they receive a flood token. When the client has accumulated

View File

@ -48,6 +48,7 @@
#endif
HandleType_t g_PlIter;
ConVar sm_datetime_format("sm_datetime_format", "%m/%d/%Y - %H:%M:%S", 0, "Default formatting time rules");
class CoreNativeHelpers :
public SMGlobalClass,
@ -118,7 +119,12 @@ static cell_t FormatTime(IPluginContext *pContext, const cell_t *params)
{
char *format, *buffer;
pContext->LocalToString(params[1], &buffer);
pContext->LocalToString(params[3], &format);
pContext->LocalToStringNULL(params[3], &format);
if (format == NULL)
{
format = const_cast<char *>(sm_datetime_format.GetString());
}
#if defined SUBPLATFORM_SECURECRT
_invalid_parameter_handler handler = _set_invalid_parameter_handler(_ignore_invalid_parameter);

View File

@ -146,7 +146,7 @@ public Action:Command_Say(client, args)
else if (strcmp(text[startidx], "thetime", false) == 0)
{
decl String:ctime[64];
FormatTime(ctime, 64, "%m/%d/%Y - %H:%M:%S");
FormatTime(ctime, 64, NULL_STRING);
if(GetConVarInt(g_Cvar_TriggerShow))
{

View File

@ -297,7 +297,7 @@ native GetTime(bigStamp[2]={0,0});
*
* @param buffer Destination string buffer.
* @param maxlength Maximum length of output string buffer.
* @param format Formatting rules.
* @param format Formatting rules (passing NULL_STRING will use the rules defined in sm_datetime_format).
* @param stamp Optional time stamp.
* @noreturn
* @error Buffer too small or invalid time format.