Old 5th May 2010, 06:51   #1
MyWay
Junior Member
 
Join Date: May 2010
Posts: 8
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:

code:

${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!

code:

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
MyWay is offline   Reply With Quote
Old 5th May 2010, 08:10   #2
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Yes, there's a flaw in the GetTime function:
PHP Code:
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'
    
IntCmp $1 9 0 0 +2
    StrCpy 
$'0$1'
    
IntCmp $2 9 0 0 +2
    StrCpy 
$'0$2'
    
IntCmp $6 9 0 0 +2
    StrCpy 
$'0$6' 
should be:
PHP Code:
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'
    
IntCmp $1 9 0 0 +2
    StrCpy 
$'0$1'
    
IntCmp $2 9 0 0 +2
    StrCpy 
$'0$2'
    
IntCmp $3 9 0 0 +Added for leading zero for the hours
    StrCpy 
$'0$3'    Added for leading zero for the hours
    IntCmp 
$6 9 0 0 +2
    StrCpy 
$'0$6' 

Last edited by jpderuiter; 5th May 2010 at 08:25. Reason: Changed to [convert] label used in FileFunc header instead of the code on Wiki
jpderuiter is offline   Reply With Quote
Old 5th May 2010, 08:18   #3
MyWay
Junior Member
 
Join Date: May 2010
Posts: 8
Thanks for the quick answer. Can I repair that somewhere? Or must I wait until the next version is ready? Sigi
MyWay is offline   Reply With Quote
Old 5th May 2010, 08:24   #4
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
You can change it in the FileFunc.nsh header (In the NSIS\Include folder).
Search for "FileFunc_GetTime_convert" in that file.
jpderuiter is offline   Reply With Quote
Old 5th May 2010, 08:45   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Please submit a bug report.

Stu
Afrow UK is offline   Reply With Quote
Old 5th May 2010, 08:49   #6
MyWay
Junior Member
 
Join Date: May 2010
Posts: 8
Thank you very much!
MyWay is offline   Reply With Quote
Old 5th May 2010, 09:00   #7
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Quote:
Originally Posted by Afrow UK View Post
Please submit a bug report.

Stu
Done
jpderuiter is offline   Reply With Quote
Old 5th May 2010, 09:03   #8
MyWay
Junior Member
 
Join Date: May 2010
Posts: 8
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.
MyWay is offline   Reply With Quote
Old 26th January 2020, 20:44   #9
TonyDS
Senior Member
 
Join Date: Jul 2003
Posts: 152
This was never fixed though, even in 3.05 it's still not fixed!
TonyDS is offline   Reply With Quote
Old 26th January 2020, 22:21   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,220
Quote:
Originally Posted by TonyDS View Post
This was never fixed though, even in 3.05 it's still not fixed!
This somehow slipped through the cracks. I don't remember if I was around back then but it is on my list now and will get fixed.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump