Unusual behavior in Change Attributes dialog

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Unusual behavior in Change Attributes dialog

Post by *MarcinW »

Steps to reproduce:

1) select any file on a FAT32 partition
2) launch menu Files -> Change Attributes
3) in Date field, enter just 2018
4) clear Time field
5) press OK - nothing will happen

6) select any file on an NTFS partition
7) launch menu Files -> Change Attributes
8) in Date field, enter just 2018
9) clear Time field
10) press OK - date will be set to 2559-01-01

Regards
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It's because TC sees it as day=2018, month=0, year=0. This leads to erroneous timestamp values. I will show an error instead.
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

ghisler(Author) wrote:It's because TC sees it as day=2018, month=0, year=0
But when I enter 5000, I get 2559-1-1.

When I enter 0, I get 2559-1-1.

And FAT32 behaves differently than NTFS...

So it doesn't seem that it's just because TC interprets the value as number of days.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2559-1-1 is just a placeholder here for an invalid date.
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Ok. So I think it would be best to do this in two steps.

Initial note: currently, in Time field, if you enter for example 1:23, TC extends it to 1:23:00. When you enter 1, TC extends it to 1:00:00. This is very nice and useful (at least for me).

So the algorithm could be:

Step 1) Extend Date and Time information entered by the user:
- date 2018-5 extend to 2018-5-1 (this will need to respect regional settings, because various date orders may be used, like y/m/d or y/d/m)
- date 2018 extend to 2018-1-1 (as above)
- time 1:23 extend to 1:23:00
- time 1 extend to 1:00:00

Step 2) Verify, that the final information is valid - for example warn, if the obtained date is 9999-99-1 or time is 99:99:00 (because the user entered 9999-99 as date or 99:99 as time).

Regards
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Time is already extended. However, date will not - when the user just enters 2018, it's not clear what date and time he wants. Also the year isn't the first value in most locales.

But I will show an error now when the date or time is clearly wrong, although I will allow some exceptions like 24:00 = 00:00.
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Great!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This should be fixed in beta 3, please test it!

You will get just <Error!> when the translation is missing, otherwise string 1396="Invalid input!".

It will also list the fields with errors. Currently date+time fields are supported, both normal and from plugins.
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Partially fixed.

Try this in Time field:

24 -> neither date, not time is changed - no error information appears

24:58 -> neither date, not time is changed - no error information appears

24:58:00 -> neither date, not time is changed - no error information appears

24:59 -> interestingly, error information appears here
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

24 -> neither date, not time is changed - no error information appears
NOT confirmed. It's set to 00:00 here.
24:58 -> neither date, not time is changed - no error information appears

24:58:00 -> neither date, not time is changed - no error information appears

24:59 -> interestingly, error information appears here
Confirmed. Maybe I should forbid 24:00 and higher?
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

ghisler(Author) wrote:Maybe I should forbid 24:00 and higher?
After reading https://en.wikipedia.org/wiki/24-hour_clock#Midnight_00:00_and_24:00, the answer is: Yes!


00:00 means the beginning of the day, 24:00 means end of the same day! They are not equal. So 2018-05-10 24:15 = 2018-05-11 0:15! So using 24:xx:xx notation would lead to many unintended results I think.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Maybe I should forbid 24:00 and higher?
I think that is the best
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

OK, I will.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This should be fixed in Total Commander 9.20 beta 4, please check!
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Confirmed that entering 24:00 or higher is no longer allowed :-)

Then comes the question about the time 23:59:59 on FAT drives - it is rounde up to 00:00:00 and the date is increased by 1 day or 22:59:59 - it is rounded up to 23:00:00.

If it is a Windows call that does the up-rounding, then I guess it is OK, otherwise maybe it would be better to round down.
Last edited by petermad on 2018-05-24, 10:54 UTC, edited 2 times in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply