Issue Information
-
#008177
-
0 - None Assigned
-
Unable To Reproduce
Issue Confirmations
-
Yes (1)No (0)
Which ones? They all seem to work for me (including the one marked as not working in the script):
[Debug]: script debug : 0 110013001 : System Tick : -638987362 [Debug]: script debug : 0 110013001 : Time Tick : 20351 [Debug]: script debug : 0 110013001 : UNIX Tick : 1399520351 [Debug]: script debug : 0 110013001 : GetTime(1) : 11 (Sec) [Debug]: script debug : 0 110013001 : GetTime(2) : 39 (Min) [Debug]: script debug : 0 110013001 : GetTime(3) : 5 (Hour) [Debug]: script debug : 0 110013001 : GetTime(4) : 4 (WeekDay) [Debug]: script debug : 0 110013001 : GetTime(5) : 8 (MonthDay) [Debug]: script debug : 0 110013001 : GetTime(6) : 5 (Month) [Debug]: script debug : 0 110013001 : GetTime(7) : 2014 (Year) [Debug]: script debug : 0 110013001 : GetTime(8) : 128 (No.day in year) [Debug]: script debug : 0 110013001 : GetTimeStr : %Y-%m/%d %H:%M:%S,40 : 2014-05/08 05:39:11 [Debug]: script debug : 0 110013001 : %a : Thu [Debug]: script debug : 0 110013001 : %A : Thursday [Debug]: script debug : 0 110013001 : %b : May [Debug]: script debug : 0 110013001 : %B : May [Debug]: script debug : 0 110013001 : %c : Thu May 8 05:39:11 [Debug]: script debug : 0 110013001 : %C : 20 [Debug]: script debug : 0 110013001 : %d : 08 [Debug]: script debug : 0 110013001 : %D : 05/08/14 [Debug]: script debug : 0 110013001 : %e : 8 [Debug]: script debug : 0 110013001 : %F : 2014-05-08 [Debug]: script debug : 0 110013001 : %g : 14 [Debug]: script debug : 0 110013001 : %G : 2014 [Debug]: script debug : 0 110013001 : %h : May [Debug]: script debug : 0 110013001 : %H : 05 [Debug]: script debug : 0 110013001 : %I : 05 [Debug]: script debug : 0 110013001 : %j : 128 [Debug]: script debug : 0 110013001 : %k : 5 [Debug]: script debug : 0 110013001 : %l : 5 [Debug]: script debug : 0 110013001 : %m : 05 [Debug]: script debug : 0 110013001 : %M : 39 [Debug]: script debug : 0 110013001 : %p : AM [Debug]: script debug : 0 110013001 : %p : P [Debug]: script debug : 0 110013001 : %r : 05:39:11 AM [Debug]: script debug : 0 110013001 : %R : 05:39 [Debug]: script debug : 0 110013001 : %S : 11 [Debug]: script debug : 0 110013001 : %T : 05:39:11 [Debug]: script debug : 0 110013001 : %u : 4 [Debug]: script debug : 0 110013001 : %U : 18 [Debug]: script debug : 0 110013001 : %V : 19 [Debug]: script debug : 0 110013001 : %w : 4 [Debug]: script debug : 0 110013001 : %W : 18 [Debug]: script debug : 0 110013001 : %x : 05/08/14 [Debug]: script debug : 0 110013001 : %X : 05:39:11Please note that, since gettimestr uses the strftime function as described in the documentation, some of the specifiers may be system or compiler dependent and may not work on some systems or compilers.
changed status to: Unable To Reproduce
Its seems only support unix/linux compilerWhich ones? They all seem to work for me (including the one marked as not working in the script):
[Debug]: script debug : 0 110013001 : System Tick : -638987362 [Debug]: script debug : 0 110013001 : Time Tick : 20351 [Debug]: script debug : 0 110013001 : UNIX Tick : 1399520351 [Debug]: script debug : 0 110013001 : GetTime(1) : 11 (Sec) [Debug]: script debug : 0 110013001 : GetTime(2) : 39 (Min) [Debug]: script debug : 0 110013001 : GetTime(3) : 5 (Hour) [Debug]: script debug : 0 110013001 : GetTime(4) : 4 (WeekDay) [Debug]: script debug : 0 110013001 : GetTime(5) : 8 (MonthDay) [Debug]: script debug : 0 110013001 : GetTime(6) : 5 (Month) [Debug]: script debug : 0 110013001 : GetTime(7) : 2014 (Year) [Debug]: script debug : 0 110013001 : GetTime(8) : 128 (No.day in year) [Debug]: script debug : 0 110013001 : GetTimeStr : %Y-%m/%d %H:%M:%S,40 : 2014-05/08 05:39:11 [Debug]: script debug : 0 110013001 : %a : Thu [Debug]: script debug : 0 110013001 : %A : Thursday [Debug]: script debug : 0 110013001 : %b : May [Debug]: script debug : 0 110013001 : %B : May [Debug]: script debug : 0 110013001 : %c : Thu May 8 05:39:11 [Debug]: script debug : 0 110013001 : %C : 20 [Debug]: script debug : 0 110013001 : %d : 08 [Debug]: script debug : 0 110013001 : %D : 05/08/14 [Debug]: script debug : 0 110013001 : %e : 8 [Debug]: script debug : 0 110013001 : %F : 2014-05-08 [Debug]: script debug : 0 110013001 : %g : 14 [Debug]: script debug : 0 110013001 : %G : 2014 [Debug]: script debug : 0 110013001 : %h : May [Debug]: script debug : 0 110013001 : %H : 05 [Debug]: script debug : 0 110013001 : %I : 05 [Debug]: script debug : 0 110013001 : %j : 128 [Debug]: script debug : 0 110013001 : %k : 5 [Debug]: script debug : 0 110013001 : %l : 5 [Debug]: script debug : 0 110013001 : %m : 05 [Debug]: script debug : 0 110013001 : %M : 39 [Debug]: script debug : 0 110013001 : %p : AM [Debug]: script debug : 0 110013001 : %p : P [Debug]: script debug : 0 110013001 : %r : 05:39:11 AM [Debug]: script debug : 0 110013001 : %R : 05:39 [Debug]: script debug : 0 110013001 : %S : 11 [Debug]: script debug : 0 110013001 : %T : 05:39:11 [Debug]: script debug : 0 110013001 : %u : 4 [Debug]: script debug : 0 110013001 : %U : 18 [Debug]: script debug : 0 110013001 : %V : 19 [Debug]: script debug : 0 110013001 : %w : 4 [Debug]: script debug : 0 110013001 : %W : 18 [Debug]: script debug : 0 110013001 : %x : 05/08/14 [Debug]: script debug : 0 110013001 : %X : 05:39:11Please note that, since gettimestr uses the strftime function as described in the documentation, some of the specifiers may be system or compiler dependent and may not work on some systems or compilers.
can you make it also support windows compiler?
Edited by Angelmelody, 08 May 2014 - 04:02 AM.
According to this, it should work on windows, but there are some specifiers that aren't available.
If the list on their website is correct, the ones from the above list that aren't available on visual studio / MSVC (and their workarounds) are:
If the list on their website is correct, the ones from the above list that aren't available on visual studio / MSVC (and their workarounds) are:
- %C: if you really need this, maybe use gettimestr("%Y", 2). - %D: equivalent to "%m/%d/%y". - %e: use "%d" instead (and use sprintf for the padding). - %F: equivalent to "%Y-%m-%d". - %G: similar to "%Y", use that if you can. - %g: similar to "%y", use that if you can. - %h: equivalent to "%b". - %k: use %H (and sprintf for the padding). - %R: equivalent to "%H:%M". - %r: equivalent to "%I:%M:%S %p". - %T: equivalent to "%H:%M:%S" - %u: ugly, but use (.@var = gettimestr("%w",1)) (i.e.: mes "Hello, today is the " + (.@var = gettimestr("%w",1)) + "th day of the week";) - %V: similar to %U, use that if you canIn other words, most of them have an easy replacement, and all others are supposed to work (if they don't, please let me know which ones don't).
With MSVC 2010 the following aren't working:
I guess we could at least warn the user when an invalid format is put, it's better than crashing IMHO, what do you think?
[Debug]: script debug : 0 110015503 : System Tick : 888436613 [Debug]: script debug : 0 110015503 : Time Tick : 44724 [Debug]: script debug : 0 110015503 : UNIX Tick : 1399562724 [Debug]: script debug : 0 110015503 : GetTime(1) : 24 (Sec) [Debug]: script debug : 0 110015503 : GetTime(2) : 25 (Min) [Debug]: script debug : 0 110015503 : GetTime(3) : 12 (Hour) [Debug]: script debug : 0 110015503 : GetTime(4) : 4 (WeekDay) [Debug]: script debug : 0 110015503 : GetTime(5) : 8 (MonthDay) [Debug]: script debug : 0 110015503 : GetTime(6) : 5 (Month) [Debug]: script debug : 0 110015503 : GetTime(7) : 2014 (Year) [Debug]: script debug : 0 110015503 : GetTime(8) : 128 (No.day in year) [Debug]: script debug : 0 110015503 : GetTimeStr : %Y-%m/%d %H:%M:%S,40 [Debug]: script debug : 0 110015503 : 2014-05/08 12:25:24 [Debug]: script debug : 0 110015503 : %a : Thu [Debug]: script debug : 0 110015503 : %A : Thursday [Debug]: script debug : 0 110015503 : %b : May [Debug]: script debug : 0 110015503 : %B : May [Debug]: script debug : 0 110015503 : %c : 05/08/14 12:25:24 [Debug]: script debug : 0 110015503 : %C : [Debug]: script debug : 0 110015503 : %d : 08 [Debug]: script debug : 0 110015503 : %D : [Debug]: script debug : 0 110015503 : %e : [Debug]: script debug : 0 110015503 : %F : [Debug]: script debug : 0 110015503 : %g : [Debug]: script debug : 0 110015503 : %G : [Debug]: script debug : 0 110015503 : %h : [Debug]: script debug : 0 110015503 : %H : 12 [Debug]: script debug : 0 110015503 : %I : 12 [Debug]: script debug : 0 110015503 : %j : 128 [Debug]: script debug : 0 110015503 : %k : [Debug]: script debug : 0 110015503 : %l : [Debug]: script debug : 0 110015503 : %m : 05 [Debug]: script debug : 0 110015503 : %M : 26 [Debug]: script debug : 0 110015503 : %p : PM [Debug]: script debug : 0 110015503 : %r : [Debug]: script debug : 0 110015503 : %R : [Debug]: script debug : 0 110015503 : %S : 14 [Debug]: script debug : 0 110015503 : %T : [Debug]: script debug : 0 110015503 : %u : [Debug]: script debug : 0 110015503 : %U : 18 [Debug]: script debug : 0 110015503 : %V : [Debug]: script debug : 0 110015503 : %w : 4 [Debug]: script debug : 0 110015503 : %W : 18 [Debug]: script debug : 0 110015503 : %x : 05/08/14 [Debug]: script debug : 0 110015503 : %X : 12:27:50@Haru
I guess we could at least warn the user when an invalid format is put, it's better than crashing IMHO, what do you think?
it shouldn't crash in theory, in what function and with what input does it crash, if you have VS available to test? Maybe there's something we can do, other than having an ugly hardcoded list of allowed values for each compiler :x
http://pastebin.com/4yeXK9pC
We could also use _CrtSetReportMode (http://msdn.microsof...y/1y71x448.aspx) to disable crashing on _ASSERTE, but I don't think this is a clean approach...
... default: /* unknown format directive */ /* ignore the directive and continue */ /* [ANSI: Behavior is undefined.] */ _ASSERTE( ( "Invalid format directive" , 0 ) ); return FALSE; break; } /* end % switch */ return TRUE; }strftime will return false in case of unknown type, but before it'll 'crash', so it seems that we need to check before calling the function, I can't think of another way other than using using a hardcoded list. Or we could have our own strftime implementation, with a quick search I found this: http://code.google.c...cddcc55a4e18a90
We could also use _CrtSetReportMode (http://msdn.microsof...y/1y71x448.aspx) to disable crashing on _ASSERTE, but I don't think this is a clean approach...