- NSIS Discussion
- Time plugin
Archive: Time plugin
Instructor
5th October 2005 07:47 UTC
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
Yathosho
5th October 2005 17:48 UTC
nice one
Instructor
27th October 2005 19:45 UTC
Changes:
-New: "CompareTime" compares two times
"Time" plugin v1.1
Instructor
29th December 2005 21:01 UTC
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
Instructor
30th December 2005 12:06 UTC
Fixed: "MathTime" inaccuracy of day/month->date conversion in one day/month
"Time" plugin v1.3
Comperio
4th January 2006 19:23 UTC
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).
:cool:
Instructor
4th January 2006 20:26 UTC
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
4th January 2006 22:02 UTC
Added: "MathTime" now can parse negative values ("-10 + -20 =" returns -30)
"Time" plugin v1.4
Comperio
5th January 2006 00:25 UTC
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! :tinfoil:
Thanks for posting the example. This should work quite nicely! :D
Instructor
16th March 2006 21:11 UTC
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
stb
27th March 2006 10:42 UTC
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).
Instructor
27th March 2006 12:43 UTC
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
28th March 2006 13:03 UTC
Added: "MathTime" now can accept negative values in the result conversion -
after "=", but except "= date".
"Time" plugin v1.6
stb
28th March 2006 19:53 UTC
Hi Instructor,
1. thanks!
2. "-v" please. Does that mean I can use "= second" now and compare using IntCmp 86400 (instead of 1)?
Instructor
28th March 2006 20:26 UTC
"-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
"second(27.03.2000 12:00:00) - second(15.05.2006 17:00:00) = day"
Result will be "-2240" - days between dates.
torpark
18th September 2006 06:06 UTC
I am unable to get time.dll to unload, even with
Function .onGUIend
RMDir /r $PLUGINSDIR
FunctionEnd
Instructor
18th September 2006 13:51 UTC
${time::Unload}
tpr
20th January 2007 06:39 UTC
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
gringoloco023
21st January 2010 15:52 UTC
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 !
Instructor
25th December 2011 16:18 UTC
Added: full unicode support on NSIS Unicode.
Time plugin v2.0