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. :)

About these ads

10 Responses to “Patching tty-clock”


  1. 1 Jeff Flowers 2009/04/10 at 8:36 PM

    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.

  2. 2 Timmy Macdonald 2009/04/10 at 10:37 PM

    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.

    • 3 Clayton Holloway 2009/05/25 at 4:04 PM

      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. :P

  3. 4 Dave Foster 2009/04/11 at 1:07 AM

    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.

  4. 5 Tom Adams 2009/04/11 at 1:12 AM

    Nice patch (I’m a strong believer in freedom 3, whatever your ability). Mine’s a little more flexible:
    http://github.com/holizz/tty-clock

    Now you can use whatever format you like for the date:
    tty-clock -f ‘%Y-%m-%d’

    Hope you like it.

    • 6 K.Mandla 2009/04/11 at 7:17 AM

      Great! Thanks. I’m going to start using this one now.

      • 7 Tom Adams 2009/04/12 at 7:05 AM

        xorg62 already pulled it into their tree so you may as well use that.

        • 8 K.Mandla 2009/04/12 at 7:14 AM

          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?

          • 9 Tom Adams 2009/04/12 at 7:39 PM

            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.

  5. 10 Mike 2009/04/11 at 3:36 AM

    “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.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Welcome!



Visit the Wiki!

Some recent desktops


May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF
 


May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games


Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,958,024 hits

Archives


Follow

Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: