Changing date/time of a Directory
Pages: 1 2
Colin Ferris (399) 1814 posts |
With Ref to changing date/time of a Directory ie Then using – to set the Dir date/time SYS"OS_File"3,“hostfs:nonsuch”,,&269e4dbf This seems to work with ADFS/MEM. |
Steve Pampling (1551) 8170 posts |
Surely that’s what OS_File 9 is for? |
Colin Ferris (399) 1814 posts |
I was using OS_File 3 – for changing the date/time. Doesn’t seem to work with VRPC ‘HostFS’ – this is used as part of Sib7 copy protection. Does ‘OS_File 3’ work with the new machines filing systems? Files can be updated ok – using this command with HostFS. The ‘Filer window’ updates when the swi is called – so perhaps it is supposed to work. Is there a way of following the swi through to test it? |
Martin Avison (27) 1494 posts |
Have you tried with the other VRPC filing system ie the ADFS image filing system? |
Colin Ferris (399) 1814 posts |
I havn’t a ADFS partition set up – but RamFS works as does MemFS. |
Stuart Swales (1481) 351 posts |
The hostfs module in RPCEmu (as at 0.8.14) does not attempt to write any catalogue information for directories – there is a ‘TODO FileCore systems usually handle this’, so OS_File 1,2,3,4 and their friends won’t work. Don’t know about VRPC hostfs. |
Steve Pampling (1551) 8170 posts |
Note: Definitely not an expert at all. |
Martin Avison (27) 1494 posts |
If OS_File 9 does not work on VRPC HostFS, but does on VRPC ADFS, RamFS and MemFS, then I suggest the question is asked on the VRPC forum or mailing list. HostFS is part of VRPC, not RISC OS. Difficulties may be because NTFS has 8 timestamps for each file & directory, and working out which is the right one to use to emulate the single RISC OS timestamp is not simple. Also how to use it has to take into account the differing ways of handling GMT vs local, summerime, territories, etc. HostFS may just avoid the issues! |
Dave Higton (1515) 3526 posts |
Resurrecting a very old thread because it’s perfectly relevant… I’ve been unable to get OS_File 9 to work on SCSIFS or RAMFS, whereas calls to OS_File 2 followed by OS_File 3 work perfectly. I was “banging my head against a brick wall” for hours, thinking this has to work. It doesn’t, but the alternative works perfectly. RO 5.29 (11-Feb-24), RPi 3B+. |
jgharston (7770) 14 posts |
OSFILE 3 writes the exec address. The datetime stamp is held in the load and exec addresses, so just writing the exec address will only write the bottom 32 bits of the datetime stamp. You should use osfile 9,filename,load,exec where load=&FFFtttdd bits 32-39 of datetime, exec=&dddddddd bits 0-31 of datetime. If that does not work, the fallback is: osfile 5, change load/exec, osfile 1, or as Dave’s found, set load and then exec seperately. If that doesn’t work, the underlying filing system is not supporting it. There are some filing system implementations that do not like setting metadata on directories. |
Stuart Swales (8827) 1357 posts |
OS_File 9 was specified to be ‘Date stamp file’, not ‘Date stamp object’. In Arthur/RO2 it used to do (internal)OS_File 5, change load/exec (to reflect current date time), (internal)OS_File 1 as JGH suggests for fallback, giving an appropriate error if the object was not a file. |
Dave Higton (1515) 3526 posts |
I have been trying to date stamp a file. Can a few volunteers please try it and post the results here – does it work? But thank you for the reminder of the distinction. |
Martin Avison (27) 1494 posts |
I have just tried OS_File,9 on a file and a directory on: RAMFS, ADFS, SDFS, LanManFS and LanMan98. It seems to work on all of them. |
Stuart Swales (8827) 1357 posts |
I think https://www.riscosopen.org/wiki/documentation/show/OS_File%209 is misleading re. use of R2,R3. Comment in my old source is “; Set datestamp on file to current” I see someone has commoned up StampFileOp and SetTypeFileOp into StampSetTypeFileOp (https://gitlab.riscosopen.org/RiscOS/Sources/FileSys/FileSwitch/-/blob/master/s/OSFile#L390) – in RISC OS 3 perhaps? Does it do what the two separate functions did? Who knows. |
Chris Hall (132) 3554 posts |
I found setting date and time to be a pain so added the facility for !MultiTask to datestamp a file or a zip archive (while SparkFS not running). Uses a menu structure to choose the date and time. So dragging a file to the MultiTask window allows the date and time to be selected from a menu: Directories are more complicated. Application directories display the date of the !RunImage file inside them, not the datestamp of the directory. On VRPC the HostFS filing system uses one of three dates (created, altered or last accessed) that Windows uses. |
Dave Higton (1515) 3526 posts |
Ah… now I see, thank you to all. I’ve updated the wiki entry for OS_File 9. No wonder I couldn’t reconcile the paper PRM with the wiki. I note that the paper PRM doesn’t actually mention that it’s the current date/time; it must just assume it because there’s no way to specify anything. |
Dave Higton (1515) 3526 posts |
And in response to the original question:
OS_File 2 followed by OS_File 3 to set the load and exec addresses. Works on files and directories, it appears. Better late than never? |
Martin Avison (27) 1494 posts |
After the various comments regarding how to set the timestamps on files and directories, I thought I would try to understand a complete picture of what worked and what did not. I created a little test program, which for each directory to test, it:
After each stage it uses *Info to display the timestamps. I ran this on…
My conclusions are that all methods changed the timestamp on all machines using:
However, using HostFS (both VRPC and RPCEmu) directories do NOT change. If anyone wants to try out my StampTest program, it can be downloaded |
David J. Ruck (33) 1635 posts |
@Chris; Please use a dialog to set the datestamp rather than SIX nested menus. Apart from being totally less horrid it would the option to retain the last datestamp set, so you can easily repeat the operation on a subsequent file. |
Stuart Swales (8827) 1357 posts |
@Martin: See my earlier comment “The hostfs module in RPCEmu (as at 0.8.14) does not attempt to write any catalogue information for directories – there is a ‘TODO FileCore systems usually handle this’, so OS_File 1,2,3,4 and their friends won’t work.” |
Rick Murray (539) 13840 posts |
Furthermore, as this is one that caught me out so I thought I’d mention it for completeness… …you cannot modify the type of an open file. |
Chris Hall (132) 3554 posts |
@Chris; Please use a dialog to set the datestamp rather than SIX nested menus. My only defence is laziness. It was far quicker to set up a menu structure than to do a window with up and down buttons for each item. When I get time I’ll do it properly. It is surprisingly quick to navigate the menus – no need to open minutes or seconds if you want them to be zero. |
Simon Willcocks (1499) 513 posts |
I’m not so sure it’s not a good approach. From decade down to the minute, how would you do it more efficiently? My phone has a good approach for time of day that only takes two “clicks”, to the minute. |
Chris Hall (132) 3554 posts |
Setting an arbitrary time and date that is somewhere between 1 Jan 1990 and (say) 2025 is going to take more than two clicks! |
Rick Murray (539) 13840 posts |
Some finger rolling and two taps can set the time with ease. Setting a date can be rather more complicated. And some of those pop-ups you get on websites for date, oh my god. There’s no shortcut on some of them for the year. Just forward and back for the month. When it is asking for a date of birth… |
Pages: 1 2