Old 5th October 2005, 07:47   #1
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Time plugin

Features:
- Get local time
- Set local time
- Get file/directory creation, last write, last access times
- Set file/directory creation, last write, last access times

Notes:
- All times in "dd.MM.yyyy hh:mm:ss" format (e.g. "01.01.2006 23:59:59")
- Win95/Win98/WinMe: Time set for directory is not supported

!! If you know assembler you can help to implement time set for directory in Win95/Win98/WinMe: link


"Time" plugin v1.0
Attached Files
File Type: zip time.zip (9.1 KB, 1286 views)
Instructor is offline   Reply With Quote
Old 5th October 2005, 17:48   #2
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,362
nice one
Yathosho is offline   Reply With Quote
Old 27th October 2005, 19:45   #3
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Changes:
-New: "CompareTime" compares two times


"Time" plugin v1.1
Attached Files
File Type: zip time.zip (9.6 KB, 956 views)
Instructor is offline   Reply With Quote
Old 29th December 2005, 21:01   #4
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: "SetLocalTime" daylight saving time problem
Changed: "CompareTime" replaced with "MathTime"
Added: UTC support ("GetLocalTimeUTC", "SetLocalTimeUTC", "GetFileTimeUTC",
           "SetFileTimeUTC")
New: "MathTime" -mathematical operations with times.
           -calculate day of the week,
           -calculate date after 60 days,
           -calculate how many days between dates,
           -compare dates,
           -calculate how many days in 1234567890 seconds ...
New: "TimeString" -get times from time string


"Time" plugin v1.2
Attached Files
File Type: zip time.zip (21.6 KB, 865 views)

Last edited by Instructor; 29th December 2005 at 21:17.
Instructor is offline   Reply With Quote
Old 30th December 2005, 12:06   #5
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: "MathTime" inaccuracy of day/month->date conversion in one day/month


"Time" plugin v1.3
Attached Files
File Type: zip time.zip (21.6 KB, 952 views)
Instructor is offline   Reply With Quote
Old 4th January 2006, 19:23   #6
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
Not sure if it would work for this plugin or not, but here's a few suggestions that would be nice to have:

1. GetWeekdayName - a function to allow the user to input a time and get back the weekday name (ie "Sunday")

2. GetWeekdayNumber - same as above, but return the weekday number. (ie Sunday=1, Monday=2, etc.)

3. GetMondayDate - input a date and have the system return the Monday from that week. For example, if you input 1/4/2005 (a Wednesday), you would get an output of 1/2/2005 (a Monday).

Comperio is offline   Reply With Quote
Old 4th January 2006, 20:26   #7
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
code:
Name "Output"
OutFile "Output.exe"

Section
#GetWeekdayNumber:
time::MathTime "day(29.12.2005 0:0:0) + 5 % 7 =" .r0
MessageBox MB_OK 'GetWeekdayNumber$\n$$0={$0}'


#GetWeekdayName:
time::MathTime "day(29.12.2005 0:0:0) + 5 % 7 =" .r0
StrCmp $0 1 0 +2
StrCpy $0 Monday
StrCmp $0 2 0 +2
StrCpy $0 Tuesday
StrCmp $0 3 0 +2
StrCpy $0 Wednesday
StrCmp $0 4 0 +2
StrCpy $0 Thursday
StrCmp $0 5 0 +2
StrCpy $0 Friday
StrCmp $0 6 0 +2
StrCpy $0 Saturday
StrCmp $0 0 0 +2
StrCpy $0 Sunday
MessageBox MB_OK 'GetWeekdayName$\n$$0={$0}'


#GetMondayDate:
!define Monday 1
!define Tuesday 2
!define Wednesday 3
!define Thursday 4
!define Friday 5
!define Saturday 6
!define Sunday 7 #!define Sunday 0

time::MathTime "day(29.12.2005 0:0:0) + 5 % 7 =" .r0
time::MathTime "day(29.12.2005 0:0:0) - $0 + ${Monday} = date" .r0
MessageBox MB_OK 'GetMondayDate$\n$$0={$0}'
SectionEnd

Instructor is offline   Reply With Quote
Old 4th January 2006, 22:02   #8
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Added: "MathTime" now can parse negative values ("-10 + -20 =" returns -30)


"Time" plugin v1.4
Attached Files
File Type: zip time.zip (21.7 KB, 841 views)
Instructor is offline   Reply With Quote
Old 5th January 2006, 00:25   #9
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
D'OH! I feel like such a dolt! I looked over the readme doc several times and didn't see the example about getting the day of the week until you posted your reply!

Thanks for posting the example. This should work quite nicely!
Comperio is offline   Reply With Quote
Old 16th March 2006, 21:11   #10
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: time::MathTime now error output is "" not "-1" (negative results allowed).
Changed: time::SetFileTime now don't changes any file time if error appeared.
Updated: example "Compare times".
Updated: "ConvFunc.h" to v1.6.
Changed: Now plugin used header "Time.nsh" for custom user variables and
              better compile errors check.

Update from previous versions:
         - Insert line in script:
            !include "Time.nsh"
         - Replace:
            time::SetLocalTime -> ${time::SetLocalTime} ...
         - Replace:
            .r0 -> $0, .r1 -> $1 ... .R0 -> $R0, .R1 -> $R1 ...

"Time" plugin v1.5
Attached Files
File Type: zip time.zip (32.9 KB, 879 views)
Instructor is offline   Reply With Quote
Old 27th March 2006, 11:42   #11
stb
Senior Member
 
Join Date: Mar 2004
Location: Germany, Paderborn
Posts: 177
Hi Instructor,

I tried something like

${time::MathTime} "day(27.03.2006 12:00:00) - day(15.05.2006 17:00:00) = day"

and got "" (error). You wrote "negative results allowed" (post above), so it should be something like "-50" (or nearby).
stb is offline   Reply With Quote
Old 27th March 2006, 13:43   #12
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Rough result:
"day(27.03.2006 12:00:00) - day(15.05.2006 17:00:00) ="

I'll check later for accurate negative result possibility:
"second(27.03.2006 12:00:00) - second(15.05.2006 17:00:00) = day"
Instructor is offline   Reply With Quote
Old 28th March 2006, 14:03   #13
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Added: "MathTime" now can accept negative values in the result conversion -
            after "=", but except "= date".


"Time" plugin v1.6
Attached Files
File Type: zip time.zip (33.1 KB, 971 views)
Instructor is offline   Reply With Quote
Old 28th March 2006, 20:53   #14
stb
Senior Member
 
Join Date: Mar 2004
Location: Germany, Paderborn
Posts: 177
Hi Instructor,

1. thanks!

2. "-v" please. Does that mean I can use "= second" now and compare using IntCmp 86400 (instead of 1)?
stb is offline   Reply With Quote
Old 28th March 2006, 21:26   #15
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Quote:
"-v" please. Does that mean I can use "= second" now and compare using IntCmp 86400 (instead of 1)?
I don't understand. The new version allow you to write the next expression
code:
"second(27.03.2000 12:00:00) - second(15.05.2006 17:00:00) = day"
Result will be "-2240" - days between dates.
Instructor is offline   Reply With Quote
Old 18th September 2006, 06:06   #16
torpark
Senior Member
 
Join Date: Apr 2006
Posts: 113
I am unable to get time.dll to unload, even with

Quote:
Function .onGUIend
RMDir /r $PLUGINSDIR
FunctionEnd
torpark is offline   Reply With Quote
Old 18th September 2006, 13:51   #17
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
code:
${time::Unload}
Instructor is offline   Reply With Quote
Old 20th January 2007, 06:39   #18
tpr
Junior Member
 
Join Date: Jan 2007
Posts: 8
Thanks for the plugin.

I am a beginner and would like to make a simple exe which sets local date back to 10 years and another one which sets the actual date.

I successfully created an exe which sets date back but don't know how to restore the actual date (and time).

If someone could help I would really appreciate it.

Thanks
tpr

Edit: problem solved, I've overlooked TimeTest.nsi

Last edited by tpr; 20th January 2007 at 08:05.
tpr is offline   Reply With Quote
Old 21st January 2010, 15:52   #19
gringoloco023
Member
 
Join Date: Nov 2009
Posts: 52
Unicode NSIS

Hello Instructor,

I hope you are still actively developing the Time plug-in?
Because, I am (we are) looking for this plug-in, recompiled to work with Unicode NSIS.
It would be really appreciated, as we are in need of a fair few plug-ins with Unicode NSIS support!

Link to Unicode NSIS homepage: scratchpaper.com/home
Link our project: portableapps.com/node/21879

Thanx a lot, in advance !
gringoloco023 is offline   Reply With Quote
Old 25th December 2011, 16:18   #20
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Added: full unicode support on NSIS Unicode.

Time plugin v2.0
Instructor 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