I'm writing Lua (5.3) in a Windows environment; the result will be used in many countries so file handling has to cater for multiple locales (which rules out the lfs and Penlight libraries) and also many date formats (as selected by the user).
I'm accessing files using luacom and Microsoft FileObject, which eliminates problems with file names, but I'm having difficulty with the DateLastModified property, which is returned in text.
I need to compare the DateLastModified for many hundreds of files to determine which is the latest.
One technique I've considered would involve temporarily setting (via the registry) the PC's Short Date format to something predictable that can be simply parsed such as "yyyy-MM-dd" (and resetting it afterwards) but I'm instinctively averse to messing with the user's registry settings, especially those that have ramifications outside my program.
I could copy each file to a temporary file with a name that allows lfs to get the modification data as an integer number of seconds, but that would seriously impact the run-time of what's supposed to be a fairly basic utility.
Is there a solution I've overlooked, or am I going to have to choose the least worst option? Note: I'm quite restricted in the libraries available in the target environment.