Page 2 of 3
Re: real Time Clock - Am and PM, not militarry!

Posted:
Wed Oct 07, 2009 8:42 am
by Bee-Ant
Yeah...DST you knock it !
Re: real Time Clock - Am and PM, not militarry!

Posted:
Tue Oct 13, 2009 12:59 am
by Hblade
O.o
Re: real Time Clock - Am and PM, not militarry!

Posted:
Sat Oct 17, 2009 4:10 pm
by Kalladdolf
LOL.
Also: Monkeys!
Re: real Time Clock - Am and PM, not militarry!

Posted:
Sat Oct 17, 2009 5:36 pm
by Bee-Ant
Hohoho, just kidding HBlade

Re: real Time Clock - Am and PM, not militarry!

Posted:
Tue Oct 20, 2009 3:46 pm
by Hblade
My ducky says hi O.o
Re: real Time Clock - Am and PM, not militarry!

Posted:
Fri May 27, 2011 3:05 pm
by Wertyboy
is this topic still alive?
i want to ask
if 22:04, it is 10:4PM, i want to make it like 10:04 PM
How?
(Im using the fixed code anyway)
Re: real Time Clock - Am and PM, not militarry!

Posted:
Fri May 27, 2011 7:07 pm
by Hblade
dunno, sorry :/ You could try if sec<10 then have it strcat(text, "0"); before finishing the seconds
Re: real Time Clock - Am and PM, not militarry!

Posted:
Fri May 27, 2011 8:22 pm
by Game A Gogo
at one point in the scripts, you have this part of code sprintf(text, "%d:%d:%d AM", Hour, u.min, u.sec);
as you can see the %d is to display a double value (Hence the d), you could also use i (I'd recommend it) for integer values "%i"
But how to add padding zeros? easy like eating a pie you like! sprintf comes with more formatting options, replace the "%d" to "%02i", the 0 indicates that it should pad with 0's (If you leave it out, it will pad with spaces) and the 2 indicates how many digits you want to appear minimum.
So...
%02i could give out: "04"
%2i could give out: " 4"
%04i could give out: "0004"
Re: real Time Clock - Am and PM, not militarry!

Posted:
Fri May 27, 2011 8:28 pm
by skydereign
Just as an extra option, you can use this (I prefer it at least). It's pretty much just like Bee-Ant's, but it adjusts for a few things.
- Code: Select all
stTime t = getTime();
sprintf(text, "%02d:%02d:%02d %s", t.hour%12, t.min, t.sec, (t.hour>11 ? "PM" : "AM"));
Oh, and there is no difference between using d or i. They both represent an int.
Re: real Time Clock - Am and PM, not militarry!

Posted:
Fri May 27, 2011 8:59 pm
by Hblade
Sky
Your intelligence amazes me. You seem to always have a new and better way of doing things and so I wanna say congrats on being able to do this

Re: real Time Clock - Am and PM, not militarry!

Posted:
Sat May 28, 2011 2:54 am
by Wertyboy
Game A Gogo wrote:at one point in the scripts, you have this part of code sprintf(text, "%d:%d:%d AM", Hour, u.min, u.sec);
as you can see the %d is to display a double value (Hence the d), you could also use i (I'd recommend it) for integer values "%i"
But how to add padding zeros? easy like eating a pie you like! sprintf comes with more formatting options, replace the "%d" to "%02i", the 0 indicates that it should pad with 0's (If you leave it out, it will pad with spaces) and the 2 indicates how many digits you want to appear minimum.
So...
%02i could give out: "04"
%2i could give out: " 4"
%04i could give out: "0004"
thx, so what about when 01:00 PM, i want it to: 13:00 (Removed AM & PM)
Re: real Time Clock - Am and PM, not militarry!

Posted:
Sat May 28, 2011 5:33 am
by MrJolteon
Wertyboy wrote:Game A Gogo wrote:at one point in the scripts, you have this part of code sprintf(text, "%d:%d:%d AM", Hour, u.min, u.sec);
as you can see the %d is to display a double value (Hence the d), you could also use i (I'd recommend it) for integer values "%i"
But how to add padding zeros? easy like eating a pie you like! sprintf comes with more formatting options, replace the "%d" to "%02i", the 0 indicates that it should pad with 0's (If you leave it out, it will pad with spaces) and the 2 indicates how many digits you want to appear minimum.
So...
%02i could give out: "04"
%2i could give out: " 4"
%04i could give out: "0004"
thx, so what about when 01:00 PM, i want it to: 13:00 (Removed AM & PM)
Here's a code I made a while back(Requires 4 text actors: Hours, minutes, seconds and : :, all codes goes into the : : actor. )
viewtopic.php?f=5&t=6667Here's an example:
http://dl.dropbox.com/u/6984849/Clock%2 ... xample.zip
Re: real Time Clock - Am and PM, not militarry!

Posted:
Sun May 29, 2011 1:27 pm
by Hblade
Re: real Time Clock - Am and PM, not militarry!

Posted:
Sun Oct 09, 2011 8:23 am
by EvanBlack
More clocks! XD I want to see some crazy stuff.
How much can you do with a clock anyway? I mean generally speaking you have a Digital, Analog, and Military. Can anyone make a sun dial?
Re: real Time Clock - Am and PM, not militarry!

Posted:
Sun Oct 09, 2011 3:28 pm
by MrJolteon
I guess, with enough coding skills