Patching tty-clock

I am not a coder. I am not a developer, a software engineer, a systems analyst, a hacker, a cracker or a computer science major. On the other hand, I have a smidgin of experience writing software, which is a meager but occasionally useful skill as one goes through life.

Since I don’t live in the U.S., I don’t read dates in that peculiar way Americans do — day first, then month, then year. Sometimes, which is even more confusing to me, the month comes first, then the day, then the year. ๐Ÿ˜

Either way, in Japan dates (and by that I don’t mean eras) are usually shown as year, month, day, and that’s what I’m used to. So I sat down this morning, cracked my knuckles and pitted my primitive coding skills against the source code for tty-clock. The result is a very short, very crisp patch that corrects the display for me.

161,162d160
<              ttyclock->tm->tm_year + 1900,
<              ttyclock->tm->tm_mon + 1,
163a162,163
>              ttyclock->tm->tm_mon + 1,
>              ttyclock->tm->tm_year + 1900,

I’m no expert, of course, but if you decompress the source code for tty-clock, save those six lines as “ttyclock.patch” and then run patch ttyclock.c ttyclock.patch -R, you should end up with a date that’s more to your liking … if your date sensibilities are at all like mine.

Of course, if you prefer some other arrangement, or if you want to inject it with the Discordian calendar, you’re on your own. ๐Ÿ™‚

12 thoughts on “Patching tty-clock

  1. Jeff Flowers

    I love Year-Month-Day, especially for anything that requires sorting. For example, I like to use Jhead to automate the naming of my digital photos, which gives me files named like this:

    20090329_22-45-13.jpg

    or

    YYYYMMDD_hh-mm-ss.jpg

    which means that it is very easy to get files sorted in chronological order. I also like using this format in spreadsheets, as it makes sorting easier there as well.

    I don’t understand why it isn’t more popular world wide.

    Reply
  2. Timmy Macdonald

    Pure American dating conventions dictate month-day-year. Which makes sense, since we normally say:
    “Today is April 9, 2009.”
    What confuses me is the UK, which does day-month-year, since that’s not the way it’s spoken.

    Reply
    1. Clayton Holloway

      I agree.
      I don’t know where he got the idea that it was the Americans that do that.

      I guess it could be that the brits say things like “Today is the 9th day of April, 2009”, but then again they drive on the wrong side of the road. ๐Ÿ˜›

      Reply
  3. Dave Foster

    As an American who lived in the UK for a year, and being endlessly confused about which was which, I now only write my dates as “10 Apr 2009” – Americans sometimes look at it funny but there’s no mistaking which means which.

    Reply
        1. K.Mandla Post author

          Quick question: I want to draft a Pkgfile for this, rather than manually rebuilding it each time. Is there a direct link to the source tarball somewhere, and I’m overlooking it? I need something I can link to with wget, but it appears that the Flash-esque download link is the only way to get the source, and it comes appended with a hash of some sort.

          Any suggestions?

          Reply
          1. Tom Adams

            You’ll want something like this:

            _gitroot=”git://github.com/xorg62/tty-clock.git”
            _gitname=”tty-clock”

            build() {
            cd $srcdir

            msg “Connecting to GIT server…”
            if [[ -d $_gitname ]]; then
            (cd $_gitname && git pull origin)
            else
            git clone $_gitroot $_gitname
            fi
            msg “GIT checkout done or server timeout”
            msg “Starting make…”
            cd $_gitname

            make || return 1
            make DESTDIR=$pkgdir install || return 1
            }

            Although it won’t quite work because the Makefile doesn’t pay attention to DESTDIR.

            Reply
  4. Mike

    “What confuses me is the UK, which does day-month-year, since thatโ€™s not the way itโ€™s spoken.”
    It is here, we say “The 9th of April, 2009”. “April the 9th, 2009” is sometimes used, but it is much rarer.

    I prefer DD-MM-YYYY, but if I am going to display the date and time I prefer ISO 8601 format, eg 2009-01-01T13:45:12+00:00.

    Reply
  5. Pingback: tty-clock: Taken for granted, for far too long | Inconsolation

  6. Pingback: tty-clock: Taken for granted, for far too long | Linux Admins

Leave a reply to Jeff Flowers Cancel reply