Show 12 hour clock
#1
hi,

i use the show 12 hour clock display.

between 12:00 pm and 12:59 pm it displays am and 12:00 am to 12:59 am it displays 00:00 am to 00:59 am.

here is a code sample that fixes this. i didn't consider this a patch, so i hope you don't mind me posting it here.

edit: i also took out the leading zero for hours that are single digit.

Quote:void cguiwindowhome::gettime(wchar* sztime, lpsystemtime ptime)
{
if (!sztime) return;
if (!ptime) return;
int ihour = ptime->whour;

if (g_guisettings.getbool("lookandfeel.clock12hour"))
{
if (ihour>11)
{
ihour-=(12*(ihour>12));
swprintf(sztime,l"%2d:%02d pm", ihour, ptime->wminute);
}
else
{
ihour+=(12*(ihour<1));
           swprintf(sztime,l"%2d:%02d am", ihour, ptime->wminute);
}
}
else
swprintf(sztime,l"%02d:%02d", ihour, ptime->wminute);
}
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#2
thanks Smile
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
slighty related at least..

i imagine that people that want the 12 hour clock, also are among the people that want to show dates as

'saturday, january 5'

instead of

'saturday, 5(th of) january'.

thus it is rather strange that in settings getting the 12 hour clock is an 'active' setting, while the date thing is an passive option. i'd say that flipping the boolean algebra of the date setting would be more.. consistent.

spiff
Reply
#4
spiff: so you are saying that you'd prefer it to be on by default, or??

cheers,
jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
no, or yes

i suggest consistency. since 12 hour clock is (i imagine) used with swap date, and use 12 hour clock is something you have to switch on, i also think that show dates as

saturday, january 5

should also correspond to 'switch date and month in home screen' on..

what i mean with consistency is that in order to get my norwegian (and i think mostly european) preference

saturday, 5 january 23:50

i have to have 12 hour clock switched off (doh)
but i have to have the swap date on

and i recon most americans preferer it the opposite way. better consistency if i had off,off imho.
Reply
#6
very nice.....wonder if you could write a small patch to see if date is greater than 100 years from now and set it to 2005 jan 1st or something like that so software doesnt get corupted but xbox not being plugged into the wall for a while.

this would be great 2

(know this isnt request forum, but code looks great and to do with date thought it may be possible)

cheers
Reply
#7
or maybe you wanna date/time settings to xbmc.
dunno why nobody coded that feature as of yet. :nuts:
read the xbmc online-manual, faq and search the forums before posting! do not e-mail the xbmc-team asking for support!
read/follow the forum rules! note! team-xbmc never have and never will host or distribute ms-xdk binaries/executables!
Reply
#8
all existing clock/time/date requests:
  - option to set clock manually in xbmc (like how microsoft dashboard can).
  - check xbox system-clock at startup, ...and correct if wrong/needed.
  - time format options (24hours vs. am/pm).
  - system-info configurable date-format? ...like to change m-d-y <=> d-m-y.
  - sleep timer function (non-idle)*
  - alarm-clock*

* = little off-topic.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#9
note numbers 3 and 4 have been in xbmc for quite some time :p

numbers 1 and 2 are dependent on how one sets the time on the xbox - i haven't investigated. geminiserver would be the one to ask on that front.

no comment on the other functions, though a sleep timer could be added to the popup button bar perhaps (though it's already got more "features" than i'd want on it)

cheers,
jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#10
not sure if your interested, but here's the change for the system info screens time display.

in cguiwindowsysteminfo::getvalues()

Quote: // time current
{
const wchar *pszcurrent=g_localizestrings.get(143).c_str();
wchar wsztime[32];
systemtime time;
getlocaltime(&time);
if (g_guisettings.getbool("lookandfeel.clock12hour"))
{
if (time.whour>11)
{
time.whour-=12*(time.whour>12);
swprintf(wsztime,l"%s %d:%02d:%02d pm %d-%d-%d",pszcurrent,time.whour,time.wminute,time.wsecond,time.wday,time.wmonth,time.wyear);
}
else
{
time.whour+=12*!time.whour;
swprintf(wsztime,l"%s %d:%02d:%02d am %d-%d-%d",pszcurrent,time.whour,time.wminute,time.wsecond,time.wday,time.wmonth,time.wyear);
}
}
else
swprintf(wsztime,l"%s %d:%02d:%02d %d-%d-%d",pszcurrent,time.whour,time.wminute,time.wsecond,time.wday,time.wmonth,time.wyear);

set_control_label(4,wsztime);
}
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#11
it's all moved into a new infomanager class now, so we should be catching them all (at least once i get around to committing my changes to cvs!Wink

thanks again for the patch Smile

cheers,
jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
Show 12 hour clock0