🐛 safer builtin_logtime

This commit is contained in:
ValKmjolnir 2022-10-30 01:30:05 +08:00
parent feea901e4d
commit 0c216e5f16
2 changed files with 2 additions and 2 deletions

View File

@ -1123,7 +1123,7 @@ var builtin_logtime(var* local,gc& ngc)
{
time_t t=time(nullptr);
tm* tm_t=localtime(&t);
char s[32];
char s[128];
sprintf(s,"%d-%.2d-%.2d %.2d:%.2d:%.2d",tm_t->tm_year+1900,tm_t->tm_mon+1,tm_t->tm_mday,tm_t->tm_hour,tm_t->tm_min,tm_t->tm_sec);
return ngc.newstr(s);
}

View File

@ -13,7 +13,7 @@ void const_str(ast& root)
void const_num(ast& root)
{
auto& vec=root.child();
f64 res;
f64 res=0;
switch(root.type())
{
case ast_add: res=vec[0].num()+vec[1].num(); break;