Results 1 to 7 of 7

Thread: 7.4.2 - Have you ever wanted a BS-free time format in mc?

Threaded View

  1. #1
    Member registered user
    Join Date
    Oct 2004
    Posts
    32

    7.4.2 - Have you ever wanted a BS-free time format in mc?

    Ever since 2008 when I started using Knoppix 5.3.1 (heavily remastered) I was stunned by the really obfuscating style of displaying access/modify/change time for files in mc.

    Simply looking at the whole column of time in a panel in mc is bound to get someone in a mental institution.

    I never understood the process of thinking on this aspect of the programmers who wrote this piece of software, otherwise very very useful.

    When it comes to representation of time, the only format that makes sense to me is "YYYY-mm-dd HH:MM".

    (Right, the year needs all 4 digits, anyone trying to tell me otherwise is missing some critical lamps. And the format having "day/month/year" is really retarded, especially when the year has only 2 digits and it's impossible to tell which is the month and which is the day and which is the year!! That is really really stupid, I'm sorry but there's just no other way of saying it.)

    Why "YYYY-mm-dd HH:MM"? Simply because it sorts itself out naturally timewise by means of regular alphabetical sorting if used in any indexing system.

    For instance I scan all my receipts from stores and save them in my data storage. And guess what the format of the file name is? "YYYY-mm-dd HH.MM Store_Name.tif"

    Simply displaying them in konqueror or any file manager they get sorted temporally by themselves.

    Quite a while ago I dug up the sources for mc-4.6.1 and started looking for a way to change the display format.
    I came up with a patch (see attachments to this message) which successfully gave me the time format displayed the way I wanted in mc.

    So now, since I started using Knoppix 7.4.2 it crossed my mind this would be the next nice trick to do in it.

    So here's what I did:
    (NOTE: everything described below is being done as root under the original Knoppix 7.4.2 DVD Live environment)

    Open a konsole window as root in an empty directory (for instance /home/knoppix/Downloads).
    Do the following:

    Code:
    sed -i -e "s/\.de\./.us./g" /etc/apt/sources.list
    rm -fv /var/cache/apt/*.bin
    rm -fv /var/lib/apt/lists/*debian*
    apt-get update
    Just for the record, I executed the code above on 2015 Jan 02. (It matters since at some point in the future the list of available package versions will change and the above code will have different consequences).

    Then I downloaded two packages from snapshot.debian.org:

    Code:
    wget http://snapshot.debian.org/archive/debian/20140317T222027Z/pool/main/libg/libgcrypt20/libgcrypt20-dev_1.6.1-2_i386.deb
    wget http://snapshot.debian.org/archive/debian/20140903T220917Z/pool/main/libs/libssh2/libssh2-1-dev_1.4.3-4_i386.deb
    Then I downloaded the sources for the version of mc in Knoppix 7.4.2:

    Code:
    wget http://snapshot.debian.org/archive/debian/20140402T100841Z/pool/main/m/mc/mc_4.8.12-1.debian.tar.xz
    wget http://snapshot.debian.org/archive/debian/20140402T100841Z/pool/main/m/mc/mc_4.8.12-1.dsc
    wget http://snapshot.debian.org/archive/debian/20140402T100841Z/pool/main/m/mc/mc_4.8.12.orig.tar.xz
    Then I made up a patch for the sources, that changes the time display format in mc's panels to what I described above.
    You can download it from the attachments to this message (mc-4.8.12-BS-free_time_format.patch.gz).

    Also you will need a script I prepared (update.sh) which looks like this:

    Code:
    #!/bin/sh
    
    #### RUN THIS AS ROOT !!!!! #####
    
    # src/setup.c lines 216 & 217 changed from:
    #define FMTYEAR _("%b %e  %Y")
    #define FMTTIME _("%b %e %H:%M")
    #                      to:
    #define FMTYEAR _("%Y-%m-%d %H:%M")
    #define FMTTIME _("%Y-%m-%d %H:%M")
    # (but it turns out it works without this, so it's not necessary)
    
    # lib/timefmt.c line 81 changed from:
    #    return i18n_timelength_cache
    #                to:
    #    return 16;
    
    # lib/timefmt.c line 114 changed from:
    #    return i18n_timelength_cache
    #                 to:
    #    return 16;
    
    # lib/timefmt.c line 139 changed from:
    #    FMT_LOCALTIME (timebuf, sizeof (timebuf), fmt, when);
    #                 to:
    #    FMT_LOCALTIME (timebuf, sizeof (timebuf), _("%Y-%m-%d %H:%M"), when);
    
    
    # Install dependencies required by the (re)building process.
    # At the time of running this script I had run "apt-get update" on 2015-Jan-02
    # after previously deleting /var/cache/apt/*.bin and /var/lib/apt/lists/*debian*
    echo -e "\n\n-------- removing libgnutls-dev ---------\n"
    apt-get -y remove libgnutls-dev
    echo -e "\n\n-------- removing libgcrypt11-dev ---------\n"
    apt-get -y remove libgcrypt11-dev
    echo -e "\n\n-------- installing libgcrypt20-dev ---------\n"
    dpkg -i libgcrypt20-dev_1.6.1-2_i386.deb
    echo -e "\n\n-------- installing libssh2-1-dev ---------\n"
    dpkg -i libssh2-1-dev_1.4.3-4_i386.deb
    echo -e "\n\n-------- installing a whole bunch ---------\n"
    apt-get -y install dh-autoreconf autopoint intltool bison check e2fslibs-dev libaspell-dev libgpm-dev libslang2-dev
    
    echo -e "\n\n-------- extracting mc-4.8.12 sources ---------\n"
    dpkg-source -x mc_4.8.12-1.dsc
    cd mc-4.8.12
    # now change src/setup.c and lib/timefmt.c as described above
    echo -e "\n\n-------- applying patch ---------\n"
    patch -p1 <../mc-4.8.12-BS-free_time_format.patch
    echo -e "\n\n-------- committing changes ---------\n"
    dpkg-source --commit
    echo -e "\n\n-------- rebuilding mc-4.8.12 debian packages ---------\n"
    dpkg-buildpackage -us -uc
    
    echo -e "\n\n-------- (re)installing mc-4.8.12 debian packages ---------\n"
    cd ..
    dpkg -i *.deb
    
    exit 0
    Copy/Paste the code above in kwrite and save it as "update.sh" in the same dir as the rest of the files.
    So at this point, your directory should look like this:

    Code:
    knoppix@Microknoppix:~/Downloads$ ls -1
    libgcrypt20-dev_1.6.1-2_i386.deb
    libssh2-1-dev_1.4.3-4_i386.deb
    mc_4.8.12-1.debian.tar.xz
    mc_4.8.12-1.dsc
    mc-4.8.12-BS-free_time_format.patch
    mc_4.8.12.orig.tar.xz
    update.sh
    Now simply type:

    Code:
    . update.sh
    or make the "update.sh" file executable and run it.

    It should run flawlessly until the end and when it's done, your directory should look like this:

    Code:
    knoppix@Microknoppix:~/Downloads$ ls -1
    libgcrypt20-dev_1.6.1-2_i386.deb
    libssh2-1-dev_1.4.3-4_i386.deb
    mc-4.8.12
    mc_4.8.12-1.debian.tar.xz
    mc_4.8.12-1.dsc
    mc_4.8.12-1_i386.changes
    mc_4.8.12-1_i386.deb
    mc-4.8.12-BS-free_time_format.patch
    mc_4.8.12.orig.tar.xz
    mc-data_4.8.12-1_all.deb
    mc-dbg_4.8.12-1_i386.deb
    update.sh
    Of course you can save the *.deb files somewhere and include them later in a Knoppix 7.4.2 remaster permanently.

    Now you can just type mc and you should see something like the snapshot attached to this message.

    Of course, first you need to go in mc's menu at "Left" or "Right" or both and change the "Listing mode" for panels to "User defined" (include "mtime" or "atime" or "ctime" somewhere in there) otherwise the time column won't be displayed.

    For instance this is what I had for "User defined" "Listing mode" when I took the snapshot:

    Code:
    half type name | size | mtime | perm | owner | group
    Attached Images Attached Images
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


A-Tech 8GB DDR3 1600 PC3-12800 Laptop SODIMM 204-Pin Memory RAM PC3L DDR3L 1x 8G picture

A-Tech 8GB DDR3 1600 PC3-12800 Laptop SODIMM 204-Pin Memory RAM PC3L DDR3L 1x 8G

$13.99



Team T-FORCE VULCAN Z 16GB (2 x 8GB) 288-Pin PC RAM DDR4 3200 (PC4 25600) XMP picture

Team T-FORCE VULCAN Z 16GB (2 x 8GB) 288-Pin PC RAM DDR4 3200 (PC4 25600) XMP

$35.99



HyperX FURY DDR3 8GB 16GB 32GB 1600 MHz PC3-12800 Desktop RAM Memory DIMM 240pin picture

HyperX FURY DDR3 8GB 16GB 32GB 1600 MHz PC3-12800 Desktop RAM Memory DIMM 240pin

$12.90



Crucial DDR3L 16GB 1600 2x 8GB PC3-12800 Laptop SODIMM Memory RAM PC3 16G DDR3 picture

Crucial DDR3L 16GB 1600 2x 8GB PC3-12800 Laptop SODIMM Memory RAM PC3 16G DDR3

$21.50



Crucial 16GB (2x 8GB) Kit DDR3L 1600MHz PC3-12800 UDIMM Desktop 240-Pin CL11 RAM picture

Crucial 16GB (2x 8GB) Kit DDR3L 1600MHz PC3-12800 UDIMM Desktop 240-Pin CL11 RAM

$23.33



8GB PC3L-12800S 1600MHz SODIMM DDR3 RAM | Grade A picture

8GB PC3L-12800S 1600MHz SODIMM DDR3 RAM | Grade A

$12.00



CORSAIR Vengeance RGB Pro 32GB (2 x 16GB) 288-Pin PC RAM DDR4 3600 (PC4 28800) picture

CORSAIR Vengeance RGB Pro 32GB (2 x 16GB) 288-Pin PC RAM DDR4 3600 (PC4 28800)

$79.95



HyperX FURY DDR4 16GB 32GB 64GB 2666MHz PC4-21300 Desktop RAM Memory DIMM 288Pin picture

HyperX FURY DDR4 16GB 32GB 64GB 2666MHz PC4-21300 Desktop RAM Memory DIMM 288Pin

$119.80



A-Tech 64GB 4x 16GB 2Rx4 PC4-17000R DDR4 2133MHz ECC REG RDIMM Server Memory RAM picture

A-Tech 64GB 4x 16GB 2Rx4 PC4-17000R DDR4 2133MHz ECC REG RDIMM Server Memory RAM

$87.96