Giter Site home page Giter Site logo

Comments (10)

muellerto avatar muellerto commented on May 27, 2024 1

I have the following now:

TimeStyle="%Y-%m-%d %H:%M:%S"
PTimeStyle="%Y-%m-%d %H:%M:%S %z"

Works immediately :) I think this is the best solution. Thanks a lot.

from clifm.

leo-arch avatar leo-arch commented on May 27, 2024

Hi @muellerto. Yes, it's intended.

Timestamps in the files list are customizable via the TimeStyle option in the configuration file. As far as I can see, you're using the legacy style (%F %T), which is not locale sensitive. Change it to whatever you like using the format modifiers provided by strftime(3). The config file provides a few examples.

As to the p and pp commands, the time style is hardcoded to %a %b %d %T.%n %Y %z (the only way I've found to add nano-second precision - %n is not provided by strftime, but inserted by clifm). These modifiers are locale sensitive.

Interesting is that the abbreviated day of week is German, the access and the birth timestamps show this, but the date format ("Jan 16") is English (German would be "16.Jan").

Jan 16 isn't English, it's the abbreviated month name according to the current locale (%b) plus the day of the month as decimal number (%d). As far as I know, there's no modifier in strftime to print something like 16.Jan (i.e. day and month name together).

EDIT: Yes, I could use %c, namely, the preferred date and time representation for the current locale. But in this case I wouldn't be able to insert the nano-second precision field, because I cannot know in advance how the resulting string will look like, and thereby I cannot manipulate it programmatically.

from clifm.

leo-arch avatar leo-arch commented on May 27, 2024

I would expect that all timestamps have just the same format and are directly comparable.

In that case, you can set the time format for the files list to the same used by the p/pp command by setting TimeStyle in the config file to something like %a %b %d %T %Y (nano-second precision is not available and the time zone (%z) might be a bit too much).

from clifm.

muellerto avatar muellerto commented on May 27, 2024

Hi @muellerto. Yes, it's intended.

Ah!

Timestamps in the files list are customizable via the TimeStyle option [...]

Yes, of course, but they are good this way. I would never change it.

As to the p and pp commands, the time style is hardcoded to %a %b %d %T.%n %z

Somewhere is a %Y missing. That year is not good there and this was indeed the motivation for my post. The year belongs truely to the date part but it appears unexpected after the nanoseconds. I know, %c does it similar but that's also not good at all, I always asked myself who needs this like this. And then comes still the time zone which belongs again to the time part. There's no order in it.

Just wanted to ask.

from clifm.

leo-arch avatar leo-arch commented on May 27, 2024

Yes, I just forgot to add the year (%Y). Do you have some advice about what would be the most convenient order/format for these fields?

EDIT: Maybe I should follow stat(1) neutral style: YYYY-MM-DD HH:MM:SS.n TZ.

from clifm.

leo-arch avatar leo-arch commented on May 27, 2024

Done. Switched to stat(1) neutral time format.

from clifm.

muellerto avatar muellerto commented on May 27, 2024

Yes, I just forgot to add the year (%Y). Do you have some advice about what would be the most convenient order/format for these fields?

I would prefer the year just after the day, so you get at least a complete date like Mo Aug 16 2023. And the entire rest is just the time part.

EDIT: Maybe I should follow stat(1) neutral style: YYYY-MM-DD HH:MM:SS.n TZ.

I would prefer that because it's similar to what I have in the files list. But I understand that other people could have other timestamps in the files list. So it would really be a good idea to keep both timestamps as similar as possible.

When I understand this right your main interest is to add nanoseconds and TZ. So you just need to search for the seconds in the TimeStyle, I mean %S. If you don't find the seconds you can't add anything (or you do then an even more sophisticated search for minutes and add also seconds). If you find a %S you have the position for the nanoseconds. It gets not much more complicated when the user used %r or %X, the seconds are always at the end. Complicated is only %c because you don't know what you get, but in that case I would just assume that the seconds are at the end, this will probably also be the case in RTL environments, so you can just add the nanoseconds after that.

from clifm.

leo-arch avatar leo-arch commented on May 27, 2024

I'll keep thinking about this (maybe adding the possibility to customize timestamps for the p command). But for the time being this is what we have:

  1. Timestamps in the files list default to the same format used by ls -l (namely %b %e %H:%M for recent files (< 6 months) and %b %e %Y for older files). This field is customizable though.
  2. Timestamps for the p command are hardcoded to the stat(1)-style: %F %T.%n %z.

1 is pretty fine: people is just used to that format and is customizable.
2 is fine too: people is used to this format as well (and we don't need to mess with locales). However, making it customizable would be nice (but we'll probably lose nano-second precision).

from clifm.

leo-arch avatar leo-arch commented on May 27, 2024

Hey @muellerto, you can now use PTimeStyle in the config file to customize file times displayed in the p/pp command (relative times are not supported, just as nano-second precision is not available for user-defined styles).

from clifm.

leo-arch avatar leo-arch commented on May 27, 2024

Hey @muellerto, nano-second precision is now available for PTimeStyle via the %N modifier. Example:

PTimeStyle="%Y-%m-%d %H:%M:%S.%N %z"

This is the default value.

from clifm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.