Topic: Time of day
I just re-read http://peaveyoxford.com/forum/viewtopic.php?id=146, but still not sure whether there is a relatively easy/safe way to generate a display of time of day that the NWare Scheduler is using.
Thanks
- George Bernard Shaw
You are not logged in. Please login or register.
I just re-read http://peaveyoxford.com/forum/viewtopic.php?id=146, but still not sure whether there is a relatively easy/safe way to generate a display of time of day that the NWare Scheduler is using.
Thanks
Generate a display where?
Fair question: on a NWare/Kiosk screen.
So a user whose watch is wrong doesn't blame the Scheduler (and/or programmer) for being wrong.
Are you using NTP? If so, you can simply sync both the Kiosk host and the Nion to the same NTP source and you won't have to bother with a special Kiosk time display, the time displayed on the task bar will be correct.
I see where Phil is coming from. He is assuming that there will not be a task bar display. The only thing the user will see is what is provided in the Kiosk window. I agree that it would certainly be useful to provide a clock device within NWare.
I wonder if Yahoo makes widgets for Linux :-)
Such as?
We wrote a script once that utilized the time library to display the time of day, it worked great in emulation but apparently that library wasn't present in the hardware implementation. Maybe if you load it in, that would be a direction?
I dug up a python PPC time module for a similar purpose. I think Ivor has it somewhere for download. I loaded it on to the Nion and it seemed to work fine. There are some particular methods that you want to stay away from.
Jason/Ivor, would you mind sharing the module and some instructions on how to load it?
The module in question is time.so available on the downloads site under Python Examples. Use it only to query the time or bad things could happen. It's not supported but is known to work. It goes in this directory on the NION: /usr/local/lib/python2.4/lib-dynload. The only way to put it there is to telnet to the NION, change to the above-mentioned directory and FTP it in. Sorry, NION only has an FTP client. If you lack a handy FTP server, Cerberus is a nice app that makes your Windows box into a temporary FTP server at the click of a mouse button. It works well enough to get the job done. My version seems to have a slow memory leak but that might be fixed by now.
Thanks for the reminder, Ivor.
You don't have a .npa with a little script that gives "message.string_set(this_is_now)", do you?
As a non-Python person, I'm having a bit of difficulty getting it going.
I got this to work (emulated) with a 1sec Blinker on the input, but can't figure out how to force leading zeros and 2 digits (%02d seems like it should work....).
import time
if inputs[0].changed_get():
this_is_now = time.localtime()
hrs = str(this_is_now[3])
min = str(this_is_now[4])
sec = str(this_is_now[5])
message.string_set(hrs + ":" + min +":" + sec)Then I got to this:
import time
if inputs[0].changed_get():
this_is_now = time.localtime()
nice_time = "%02d:%02d:%02d" % (this_is_now[3],this_is_now[4],this_is_now[5])
message.string_set(nice_time)Later in the night, I played with strftime, but will have to wait until Monday to play with real hardware:
import time
if inputs[0].changed_get():
this_is_now = time.localtime()
the_time = time.strftime("%H:%M:%S", this_is_now)
date = time.strftime("%d %B %Y", this_is_now)
message.string_set(this_is_now)
outputs[0].string_set(the_time)
outputs[1].string_set(date)
if this_is_now[8] ==1:
outputs[2].string_set("Daylight Saving: YES")
else:
outputs[2].string_set("Daylight Saving: NO")Worked with hardware!!
Any other suggestions? Or cautions??
Last edited by phils (2009-04-06 00:55:19)
I am afraid I'll have to leave this one to someone who knows more about Python than I. Jason Valenzuela was the first to query the clock via Python, as well as find the time module which he gave to me. All Hail Jason! A True NION Python Pioneer! I just had to say that. :-)
FYI, by "Pioneer" Ivor actually means "One who got in way over his head and had to converse with Peavey tech support quite frequently and at odd hours."
Amen, but he was a quick learner. (And may soon be winning the "most posts" contest).
Amen, but he was a quick learner. (And may soon be winning the "most posts" contest).
As if it is really a contest, Scott... moar content and less meta-discussion, plz. thx!
Fair question: on a NWare/Kiosk screen.
So a user whose watch is wrong doesn't blame the Scheduler (and/or programmer) for being wrong.
There may be a really cool and handy way to do this in the near future... so if you can wait a bit, you will likely not have to endanger bricking your NION by loading unsupported libraries on it. I'll let everyone know more as soon as more information becomes available.
If you have a ConMan(or nControl), I believe the Python time module exists on it. No need to hack it on to a NioNode.
Can anyone think of a reason we shouldn't include time.so in the regular release? If not it is easy enough to throw it in.
Also, you can eliminate the blinker by using a threaded script and a wait. For example:
import time
while( 1 ):
this_is_now = time.localtime()
the_time = time.strftime("%H:%M:%S", this_is_now)
date = time.strftime("%d %B %Y", this_is_now)
message.string_set(this_is_now)
outputs[0].string_set(the_time)
outputs[1].string_set(date)
if this_is_now[8] ==1:
outputs[2].string_set("Daylight Saving: YES")
else:
outputs[2].string_set("Daylight Saving: NO")
event.wait(100)This will execute every 100ms. Possibly uses some more CPU but not much.
Powered by PunBB, supported by Informer Technologies, Inc.
Generated in 0.041 seconds, 11 queries executed