Author Topic: Change 24 Hour Clock  (Read 5472 times)

prrthd

  • Newbie
  • *
  • Posts: 4
    • View Profile
Change 24 Hour Clock
« on: December 31, 2006, 04:07:41 pm »
I have been searching around the forums to an answer to this question but with no luck. In pdaxrom how do you change the time format to be 12 hour vs 24 hour?

Thanks,
   Jay

Jon_J

  • Hero Member
  • *****
  • Posts: 1853
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #1 on: January 31, 2007, 01:16:44 am »
Bump ^
I curious about this also. I really don't like the "military" time that is on the taskbar.
Isn't there an applet to replace the taskbar clock??

Thank you,
Jon
« Last Edit: January 31, 2007, 01:17:02 am by Jon_J »
C3100 Multiboot-->Angstrom 2007.12-r18 | Cacko 1.23 | ArchLinuxARM
C3200 pdaxii13v2-5.5-alpha4 Akita on NAND

Ambicom WL1100C-CF Wifi - Ambicom CF modem - Ambicom CF GPS - Belkin-F5D5050 USB LAN
Socket CF Bluetooth rev K - Iogear 4 port USB micro hub - pocket CF card reader
Targus mini USB optical mouse - 2 Targus SD card readers

harvell

  • Full Member
  • ***
  • Posts: 241
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #2 on: January 31, 2007, 01:31:17 am »
Hear! Hear!.... I concur....
C1000 w/...  Cacko Lite (When I use the Z alot for business)... pdaXrom (when I see something cool and want to try it.  Best way for me to learn shell commands)
Eee PC for Mrs. Harvell  
4G SD

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #3 on: January 31, 2007, 05:45:27 am »
ok guys, I'm just modifying the clock applet to display 3:45p instead of 15:45 for you.
Just let me know (as I am from Germany, so unsure):

What is midnight (0:00)? Is it 12:00a or 12:00p?
(Same question for noon).

EDIT: Or do you prefer not to habe a and p displayed at all?
Thanks
daniel
« Last Edit: January 31, 2007, 05:51:35 am by daniel3000 »
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #4 on: January 31, 2007, 05:59:08 am »
Please let me know how you like this one.

I could not upload the binary with its original name, so I appended .txt as an extension. Please remove that extension and chmod +x the file if necessary.

Just start the binary from a console to test it, and if it pleases you, replace /usr/bin/mb_applet_clock with this new one.

 [ Invalid Attachment ]

daniel
« Last Edit: January 31, 2007, 05:59:41 am by daniel3000 »
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

tanjian2

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Change 24 Hour Clock
« Reply #5 on: January 31, 2007, 06:20:38 am »
Can't seem to get to Greenwich site at the minute but google cache produced the following text:   

A.M. and P.M.
What is Noon and Midnight?

A.M. and P.M. start immediately after Midnight and Noon (Midday) respectively.

This means that 00:00 A.M. or 00:00 P.M. (or 12:00 A.M. and 12:00 P.M.) have no meaning.

Every day starts precisely at midnight and A.M. starts immediately after that point in time e.g. 00:00:01 A.M. (see also leap seconds)

To avoid confusion timetables, when scheduling around midnight, prefer to use either 23:59 or 00:01 to avoid confusion as to which day is being referred to.

The US officiial NIST site says something similar..... so if you code the strict definition .... I guess it will only be a problem on a very dark day, or underground given most of us will have daylight at 12:00 noon. Worst case you would have to wait 1 second to know .......

Hope this helps?
SL-C3000(Spitz) - pdaXii13 5.5alpha + sound enhanced kernel - MD in 1 great big partition -  Ambicom CF Wifi + USB Ethernet  and NOW Zubuntu on a 4Gb SD

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #6 on: January 31, 2007, 06:31:19 am »
Thanks... Well, I just realized there is an "automatic" AM/PM suffix using the strftime function, so I've used that one for the above binary and leave responsibility for correctness of AM/PM to the people who developed these time functions  


Will play a bit more with the clock applet and see if I can modify it to be a general one, configurable via command line switches.

daniel
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #7 on: January 31, 2007, 08:55:08 am »
Okay guys, so here it goes:
The new fully configurable clock applet  

Here are the command line options:

Code: [Select]
 -c color
  Give a color name or hex RGB value; hex RGB values must be given within quotes, e.g.
  red
  white
  "#9E9E33"
  (default is black)
  
  -f font
  Give a font name. If font name contains more than one word, use quotes.
  (default is "Sans Bold")
  
  -m
  (don't use military time)
  
  -D
  display date (it's a capital D, don't use the lower-case d)
  Displays weekday and day of the month behind the time
  
  -p padding
  Padding value in pixels: The amount of pixels around the time display
  The higher the value, the smaller the font.
  Min = 0, Max = 20. (you can go higher, but it does not make sense)
  (default: 0)
  
  -w
  This chooses the default parameters for the weeXpc distribution:
  Arial, Yellow, Padding=6, Display the date.

For example, try the following commands:

Code: [Select]
./mb-applet-clock -m -f "Arial" -c blue -p 4

./mb-applet-clock -m -f "Times italic" -c white -D

And this is the binary (remove .txt extension and make it executable):  [ Invalid Attachment ]



Have fun and please report problems.

daniel
« Last Edit: January 31, 2007, 09:02:21 am by daniel3000 »
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

Jon_J

  • Hero Member
  • *****
  • Posts: 1853
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #8 on: January 31, 2007, 11:28:31 am »
It seems to work, but as soon as you exit the console, or use ctrl+c in the console, the clock closes.
I'll see if it survives a restart.
It doesn't autoload, I'm going back to the original file.

EDIT:
Using the taskbar > "add", places this clock on the taskbar, just like the original one.
But how do you access the commandline options?
If you launch it using the commandline, it closes as soon as you exit the console.
« Last Edit: January 31, 2007, 11:37:34 am by Jon_J »
C3100 Multiboot-->Angstrom 2007.12-r18 | Cacko 1.23 | ArchLinuxARM
C3200 pdaxii13v2-5.5-alpha4 Akita on NAND

Ambicom WL1100C-CF Wifi - Ambicom CF modem - Ambicom CF GPS - Belkin-F5D5050 USB LAN
Socket CF Bluetooth rev K - Iogear 4 port USB micro hub - pocket CF card reader
Targus mini USB optical mouse - 2 Targus SD card readers

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #9 on: January 31, 2007, 11:45:52 am »
Quote
It seems to work, but as soon as you exit the console, or use ctrl+c in the console, the clock closes.
I'll see if it survives a restart.
It doesn't autoload, I'm going back to the original file.

EDIT:
Using the taskbar > "add", places this clock on the taskbar, just like the original one.
But how do you access the commandline options?
If you launch it using the commandline, it closes as soon as you exit the console.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153040\"][{POST_SNAPBACK}][/a][/div]


Oh yes, I should have mentioned that.
Just insert the command for it into the file ~/.matchbox/mbdock.session

There should be an mb-applet-clock somewhere, if the clock is active.
Just append the desired options to this command.
If you cannot find the command, then add it.

All this must be done outside X, because when X is terminated, the mbdock.session file is written using the current panel status.


You can test on the command line in order to find the options. but you are right: As soon as you close the commadn line / terminate the process, the clock vanishes again.

It has to be loaded permanently, e.g. by mbdock.session.

daniel
« Last Edit: January 31, 2007, 11:47:16 am by daniel3000 »
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

Jon_J

  • Hero Member
  • *****
  • Posts: 1853
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #10 on: January 31, 2007, 12:04:40 pm »
That doesn't work either.
If you remove the clock from the panel by using the click-hold method, then edit the above file, the clock doesn't come back. When you add it back, nothing is changed.
If you edit the file or replace it with your edited file while the clock is active, still nothing changes.
I'm talking about the mbdock.session file.

This won't survive a reboot either.

We need something more intuitive and permanent...
C3100 Multiboot-->Angstrom 2007.12-r18 | Cacko 1.23 | ArchLinuxARM
C3200 pdaxii13v2-5.5-alpha4 Akita on NAND

Ambicom WL1100C-CF Wifi - Ambicom CF modem - Ambicom CF GPS - Belkin-F5D5050 USB LAN
Socket CF Bluetooth rev K - Iogear 4 port USB micro hub - pocket CF card reader
Targus mini USB optical mouse - 2 Targus SD card readers

Jon_J

  • Hero Member
  • *****
  • Posts: 1853
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #11 on: January 31, 2007, 12:11:38 pm »
Restarting X made the changes go into effect.
I'll have to copy all this down for later, if I ever need to change the clock again.

BTW, thank you daniel3000 for working on this.
I think I'm not the only one who prefers a configurable clock.
« Last Edit: January 31, 2007, 12:14:34 pm by Jon_J »
C3100 Multiboot-->Angstrom 2007.12-r18 | Cacko 1.23 | ArchLinuxARM
C3200 pdaxii13v2-5.5-alpha4 Akita on NAND

Ambicom WL1100C-CF Wifi - Ambicom CF modem - Ambicom CF GPS - Belkin-F5D5050 USB LAN
Socket CF Bluetooth rev K - Iogear 4 port USB micro hub - pocket CF card reader
Targus mini USB optical mouse - 2 Targus SD card readers

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #12 on: January 31, 2007, 12:18:52 pm »
Quote
We need something more intuitive and permanent...
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153047\"][{POST_SNAPBACK}][/a][/div]

It is important that you edit the mbdock.session file when X is not running, because X reads it at startup and writes it on shutdown, so modificatoins which you did while X is running are overwritten.

There may be a more intuitive way:

Once you found your prefered command line options, add them to the file /usr/share/applications/mb-applet-clock.desktop to the Exec line.

However, I am not sure if this will work, i.e. if these optoins will also be written automatically into the mbdock.session file on X shutdown.

However, if this works, you can remove and restart the clock applet as many times as you want without losing the options.

There is no more intuitive way to use command line options on applets, as far as I know.
If you need a GUI-based solution, one would have to rewrite the applet entirely, making it use a config file and a configuration menu, so it can be started without command line options.

If it turns out that using the .desktop file the options are not preserved either, it is still possible to write a wrapper script with the command line options, and et the .desktop file start that wrapper script instead of the actual binary.


I have a completely different solution:
I have created a copy of the mbdock.session file, configured that file to fit my needs, and added a command to the ~/.xinitrc script which always overwrites the mbdock.session file with my fixed copy.
That way, I can use whatever command line options I want,
I can edit that copy of the file always, even when under X,
BUT I lose the feature that I can permanently add and remove applets to / from the panel. I can add / remove tham for the running session, but as soon as I restart X, the configuration from the mbdock.session copy is restored.

Initially, I chose that method because some or all applets occasionally vanished (which is fixed now, I think). I had to re-start them manually, then restart X, to have them in the mbdock.session file again.
So I created that fixed configuration with my prefered applets and let xinitrc always use that one instead of the one saved on last X exit.


You see, there are a lot of options.
You just have to choose the one which has the most advantages and least disadvantages for you.

daniel
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

Jon_J

  • Hero Member
  • *****
  • Posts: 1853
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #13 on: January 31, 2007, 12:38:57 pm »
I posted again before your last reply.
Since I don't have a graphical text editor that can browse hidden files/directories, this is what I did.
I copied mbdock.session file to my hard drive, then opened it in leafpad and edited it.
I then copied it back to it's original directory.
I did this while the clock was active.
Then I exited X, and restarted X. The clock (with my settings) is visible now.
C3100 Multiboot-->Angstrom 2007.12-r18 | Cacko 1.23 | ArchLinuxARM
C3200 pdaxii13v2-5.5-alpha4 Akita on NAND

Ambicom WL1100C-CF Wifi - Ambicom CF modem - Ambicom CF GPS - Belkin-F5D5050 USB LAN
Socket CF Bluetooth rev K - Iogear 4 port USB micro hub - pocket CF card reader
Targus mini USB optical mouse - 2 Targus SD card readers

harvell

  • Full Member
  • ***
  • Posts: 241
    • View Profile
    • http://
Change 24 Hour Clock
« Reply #14 on: January 31, 2007, 01:08:22 pm »
Thank you
C1000 w/...  Cacko Lite (When I use the Z alot for business)... pdaXrom (when I see something cool and want to try it.  Best way for me to learn shell commands)
Eee PC for Mrs. Harvell  
4G SD