Archive: Bug in ${GetTime} ?


Bug in ${GetTime} ?
  Hi

I am new in using NSIS. Thanks for all the possibilities of that. I searched long and found no better one! Many thanks.

Maybe I did something wrong!? Or is it a bug?

When I use the ${GetTime} part of the samples:


${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
MessageBox MB_OK 'Date=$0/$1/$2 ($3)$\nTime=$4:$5:$6'


the year, month, monthday, minutes and seconds are correct, but not the hours. I do not mean the content. I mean the formatting. If the content is only one digit (0..9) they are played a leading zero back. That is ok and fine. But not for the hours!


Date=05/05/2010 (Wednesday)
Time=8:06:08


I wanted to use that to automatically build file names of the installation timestamp, but in that way that is not usable. Did I something wrong?

I use MakeNSISW 2.3.

Sigi

Yes, there's a flaw in the GetTime function:

FileFunc_GetTime_convert:
System::Call '*$7(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)i(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
System::Free $7

IntCmp $0 9 0 0 +2
StrCpy $0 '0$0'
IntCmp $1 9 0 0 +2
StrCpy $1 '0$1'
IntCmp $2 9 0 0 +2
StrCpy $2 '0$2'
IntCmp $6 9 0 0 +2
StrCpy $6 '0$6'
should be:
FileFunc_GetTime_convert:
System::Call '*$7(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)i(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
System::Free $7

IntCmp $0 9 0 0 +2
StrCpy $0 '0$0'
IntCmp $1 9 0 0 +2
StrCpy $1 '0$1'
IntCmp $2 9 0 0 +2
StrCpy $2 '0$2'
IntCmp $3 9 0 0 +2 ; Added for leading zero for the hours
StrCpy $3 '0$3' ; Added for leading zero for the hours
IntCmp $6 9 0 0 +2
StrCpy $6 '0$6'

Thanks for the quick answer. Can I repair that somewhere? Or must I wait until the next version is ready? Sigi


You can change it in the FileFunc.nsh header (In the NSIS\Include folder).
Search for "FileFunc_GetTime_convert" in that file.


Please submit a bug report.

Stu


Thank you very much!


Originally posted by Afrow UK
Please submit a bug report.

Stu
Done

Now we have two bug reports! Why do you read it is my job and do it by yourself!? You didn't follow the bug reporting rules: Have a look if the bug is already reported. ;)

But, have a nice day. And many thanks.