Is there an easy way to apply an offset to the time attr?
Moderators: white, Hacker, petermad, Stefan2
Is there an easy way to apply an offset to the time attr?
Is there an easy way in Total Commander to apply an offset to the time attribute of a file?
For example, I travel with my digi-cam and often forget to set the internal clock to match the new timezone. I want the file timestamps to reflect the local time at the moment I take the picture. So I want to apply, say, a two or three hour offset from the current hour timestamped on the file.
Typical timestamp utils fail because the new value isn't an offset from the current value.
If, heaven forbid, TC can't do it, any recommendations for one that can?
Thanks!
strider
For example, I travel with my digi-cam and often forget to set the internal clock to match the new timezone. I want the file timestamps to reflect the local time at the moment I take the picture. So I want to apply, say, a two or three hour offset from the current hour timestamped on the file.
Typical timestamp utils fail because the new value isn't an offset from the current value.
If, heaven forbid, TC can't do it, any recommendations for one that can?
Thanks!
strider
Yepp, AddTime from http://thehacker.host.sk/addtime/
BTW: It's on the AddOns page of www.ghisler.com now, too.
HTH
Roman
BTW: It's on the AddOns page of www.ghisler.com now, too.
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
After I tried ReDate, I decided to try AddTime ... and also one bug hasn't bypassed my attention . Here it is:
I selected several files/dirs and specified to add 1 year and to subtract 1 day. Your app done this, and additionaly it added 2 seconds almost to all the files (26 out of 32). Probably it's some bonus!
I repeated the test and results were absolutely the same, so it's persistent bug, must be easy to find.
I selected several files/dirs and specified to add 1 year and to subtract 1 day. Your app done this, and additionaly it added 2 seconds almost to all the files (26 out of 32). Probably it's some bonus!
I repeated the test and results were absolutely the same, so it's persistent bug, must be easy to find.
Mmm, rather sounds like some rounding thing of the 2-sec precision of FAT or something like that, since the routine to do the time changes is:
As you see, there should be no bug... well, you can check the source, too.
Thanks
Roman
Code: Select all
for i := 0 to filelist.Count - 1 do
begin
date := filedatetodatetime(fileage(filelist[i]));
date := incyear(date, YearsSpinEdit.Value);
date := incmonth(date, MonthsSpinEdit.Value);
date := incday(date, DaysSpinEdit.Value);
date := inchour(date, HoursSpinEdit.Value);
date := incminute(date, MinutesSpinEdit.Value);
date := incsecond(date, SecondsSpinEdit.Value);
filesetdate(filelist[i], datetimetofiledate(date));
end;
Thanks
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Unfortunately (or fortunately ) I don't have any Pascal sources compiling tools, nor I have API manuals for Pascal (I didn't find neither datetimetofiledate, nor filedatetodatetime, nor incxxxx functions in WinAPI manual), moreover I never wrote in Pascal (although syntax is quite clear). Try the test I described on NTFS, can you reproduce it? If yes, then you can run the program step-by-step and discover what function does that bad...
I didn't find neither datetimetofiledate, nor filedatetodatetime, nor incxxxx functions in WinAPI manual
Those are Delphi functions so you won't find them in the Windows API.
Try the test I described on NTFS, can you reproduce it?
Yes.
If yes, then you can run the program step-by-step and discover what function does that bad...
I can't since my development environment is W98SE at home...
Thanks
Roman
Those are Delphi functions so you won't find them in the Windows API.
Try the test I described on NTFS, can you reproduce it?
Yes.
If yes, then you can run the program step-by-step and discover what function does that bad...
I can't since my development environment is W98SE at home...
Thanks
Roman
Well, a quick and dummy way to create a "debugging" environment is to display a messagebox after the call of each function, to see what values it returns. Then you compile the source code and use it in an NTFS environment compiled. You try the same with the same files in an Win98 environment and you see which value is different in the two environments. Dum but it should work (taking into consideration all the +-1 hr for daylight savings and other differences between FAT and NTFS).Hacker wrote:I can't since my development environment is W98SE at home...
Ciao...
- Wanderer -
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
awcdelphi.exe and awcwinapi.exe both work as before: values displayed in the temporary message boxes are valid but on disk I still receive the 2-second bonus.
What?!? How? I mean, What?!? How? Err... so you're saying that the times in the messageboxes are fine (ie the second and third timestamps are the same) but the ones on disk are not?
TIA
Roman
What?!? How? I mean, What?!? How? Err... so you're saying that the times in the messageboxes are fine (ie the second and third timestamps are the same) but the ones on disk are not?
TIA
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
You were so amazed that I checked this again more attentively.Hacker wrote:What?!? How? I mean, What?!? How?
Example: modification time of some file was "05.06.2003 17:53:42.329" (last 3 digits are milliseconds). After I applied AddTime with "+1 year" task the file's ModfifyTime became "05.06.2004 17:53:44.000". Your temp msg box showed the following:
Code: Select all
c:\tipa papka takaja\tipa tozhe\tipa fajlo takoe.txt
Previous date: 05.06.2003 17:53:44
New date should be: 05.06.2003 17:53:44
New date is: 05.06.2003 17:53:44
The reason why some files are handled OK (remember, I wrote that 6 files don't receive 2-second makeweight) is that they have even number of seconds and 0 milliseconds.
Nevertheless one note: TC is also written in Delphi, therefore it must be using the same time function as your AddTime, but it snaps to the previous "time quantum"??? (TC displays "05.06.2003 17:53:42.329" time as "05.06.2003 17:53:42, whereas AddTime displays it as "05.06.2003 17:53:44")
Second note: What kind of WinAPU do you use in awcwinapi.exe? WinAPI's GetFileTime or FindFirstFile return valid times but awcwinapi.exe displays wrong ones...
OK, great, thank you, that finally shed some light onto the whole matter.
The problem seems to be in getting the time - I am still doing this using Delphi functions, I am using winapi only to set the time. I'll try getting the time through winapi, too, and see if it works, but the time manipulations - I am afraid it would be a lot of work if they didn't work, so I hope it's enough to use winapi for getting and setting the time.
BTW: Are you sure the info in the [ code ] box is correct? Especially the year in the New date...?
Thanks
Roman
The problem seems to be in getting the time - I am still doing this using Delphi functions, I am using winapi only to set the time. I'll try getting the time through winapi, too, and see if it works, but the time manipulations - I am afraid it would be a lot of work if they didn't work, so I hope it's enough to use winapi for getting and setting the time.
BTW: Are you sure the info in the [ code ] box is correct? Especially the year in the New date...?
Thanks
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Hey again Valentino,
Please try http://thehacker.host.sk/myfiles/testft2dt.zip . It gets the timestamp using GetFileTime and then converts it to Delphi's own format. I'd like to see if that works for a start.
BTW: How do you get the exact filetime on a NTFS system? Alt-Enter doesn't show the milliseconds, for instance.
TIA
Roman
Please try http://thehacker.host.sk/myfiles/testft2dt.zip . It gets the timestamp using GetFileTime and then converts it to Delphi's own format. I'd like to see if that works for a start.
BTW: How do you get the exact filetime on a NTFS system? Alt-Enter doesn't show the milliseconds, for instance.
TIA
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
An updated version - http://thehacker.host.sk/myfiles/testplus1year.zip - also tests adding one year to the date.
TIA
Roman
TIA
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.