Re: change "timeformat_old" from 6 months to 1 year
On 9/20/16, Fourhundred Thecat <400the...@gmx.ch> wrote: >> On 2016-09-19 05:11, Mooffie wrote: >> That expression (6 * 30 * 24 * 60 * 60) equals 0x00ed4e00. Use MC's >> viewer to edit /usr/bin/mc: press for hex view. Search for "00 4e >> ed 00" (assuming little endian). > > I did not manage to find the hex string 0x00ed4e00, using any of my hex > editors, so I ended up recompiling mc. That's weird. For the record: I grabbed a few MC binaries off the "Binaries" webpage and found `00 4e ed 00` in all of them. Perhaps you forgot to select the "Hexadecimal" radio button in the search dialog. Whatever, if you feel adventurous and want to investigate this matter further, compile MC with debugging support (e.g., "./configure . CFLAGS='-g -O0'"), and then interact with gdb: $ gdb ./mc # break file_date # run ( when it returns to the debugger: ) # disassemble /mr You'll then see what bytes the expression "if (current_time > ... + 6L * 30L * 24L * 60L * 60L)" got compiled into.) > > Perhaps, it would make sense to make this option configurable > via the ini file? I don't know. Personally I'd aim higher: make it possible to color fields (preferably at individual character level). You'd then use this feature to display old dates dimmed. But this feature only makes sense if MC had scripting support, to let users describe their logic using code. Simple settings, like those in ini files, aren't flexible enough. > > Or set 12 months by default, because that makes more > logical sense than 6 months. The "6 months" boundary isn't arbitrary: it's intended to match the behavior of 'ls' ( http://pubs.opengroup.org/onlinepubs/007908799/xcu/ls.html ). ___ mc mailing list https://mail.gnome.org/mailman/listinfo/mc
Re: change "timeformat_old" from 6 months to 1 year
> On 2016-09-19 05:11, Mooffie wrote: > > On 9/19/16, Mooffiewrote: >> >> One possibility is to modify MC's source code: >> >> https://source.midnight-commander.org/S/lib--timefmt.c.html#L133 >> >> Change the "6L" (six months) to "12L". > > Or you can edit the MC binary directly. > > That expression (6 * 30 * 24 * 60 * 60) equals 0x00ed4e00. Use MC's > viewer to edit /usr/bin/mc: press for hex view. Search for "00 4e > ed 00" (assuming little endian). But it turns out MC's hex search has > a bug: you should tick the "All charsets" and "Case sensitive" > checkboxes first. I did not manage to find the hex string 0x00ed4e00, using any of my hex editors, so I ended up recompiling mc. But thanks for the help. Perhaps, it would make sense to make this option configurable via the ini file? Or set 12 months by default, because that makes more logical sense than 6 months. ___ mc mailing list https://mail.gnome.org/mailman/listinfo/mc
Re: change "timeformat_old" from 6 months to 1 year
On Mon, 19 Sep 2016, Mooffie wrote: On 9/19/16, Mooffiewrote: One possibility is to modify MC's source code: https://source.midnight-commander.org/S/lib--timefmt.c.html#L133 Change the "6L" (six months) to "12L". Or you can edit the MC binary directly. That expression (6 * 30 * 24 * 60 * 60) equals 0x00ed4e00. Use MC's viewer to edit /usr/bin/mc: press for hex view. Search for "00 4e ed 00" (assuming little endian). But it turns out MC's hex search has a bug: you should tick the "All charsets" and "Case sensitive" checkboxes first. ... which reminds of how I learned the first pieces of knowledge about hex some 20 years ago: I set out to patch Dune 2 save files to get unlimited spice by replacing the actual value with FF FF (having overheard the conversation in the corridor). Of course, on the first attempt, I did it in ACSII mode and guess what, it didn't work! Later, I've got my hands on hiew, as nc at that time, I think, didn't have a hex editor inbuilt. Are we seriously THAT old? Sigh... -- Sincerely yours, Yury V. Zaytsev ___ mc mailing list https://mail.gnome.org/mailman/listinfo/mc
Re: change "timeformat_old" from 6 months to 1 year
On 9/19/16, Mooffiewrote: > > One possibility is to modify MC's source code: > > https://source.midnight-commander.org/S/lib--timefmt.c.html#L133 > > Change the "6L" (six months) to "12L". Or you can edit the MC binary directly. That expression (6 * 30 * 24 * 60 * 60) equals 0x00ed4e00. Use MC's viewer to edit /usr/bin/mc: press for hex view. Search for "00 4e ed 00" (assuming little endian). But it turns out MC's hex search has a bug: you should tick the "All charsets" and "Case sensitive" checkboxes first. ___ mc mailing list https://mail.gnome.org/mailman/listinfo/mc
Re: change "timeformat_old" from 6 months to 1 year
On 9/18/16, Fourhundred Thecat <400the...@gmx.ch> wrote: > Hello, > > I am using different date formats for "timeformat_recent" and > "timeformat_old": > > [Misc] > timeformat_recent=%b %e %H:%M > timeformat_old=%Y %b %e %H:%M > > which gives me nice, clean dates, where new files are immediately > distinguished from older ones: > >Sep 3 15:13 > 2016 Mar 10 19:57 > > that works great, except that "timeformat_old" is used for files 6 > months or older. > > I would like to change it to 1 year or older, so that for newer files > (less than one year), I don't see the year. > > How can I do it ? One possibility is to modify MC's source code: https://source.midnight-commander.org/S/lib--timefmt.c.html#L133 Change the "6L" (six months) to "12L". (Another possibility is to use mc^2 and describe the logic with Lua. This gives you more freedom than a fixed "1 year ago". For example, here's a snippet that shows your timeformat_recent only for files modified in 2016: https://gist.github.com/mooffie/de41af651f9383c3bd38f0f6259522a0 ) ___ mc mailing list https://mail.gnome.org/mailman/listinfo/mc