1

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

"The single biggest problem in communication is the illusion that it has taken place."
                                                                                        - George Bernard Shaw

2

Re: Time of day

Generate a display where?

3

Re: Time of day

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.

"The single biggest problem in communication is the illusion that it has taken place."
                                                                                        - George Bernard Shaw

4

Re: Time of day

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.

5

Re: Time of day

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.

Josh Millward
Burnt Orange Studios

6

Re: Time of day

I wonder if Yahoo makes widgets for Linux  :-)

Make it intuitive, never leave them guessing.

7

Re: Time of day

Such as?

8

Re: Time of day

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?

Thanks,

Joe

9

Re: Time of day

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.

10

Re: Time of day

Jason/Ivor, would you mind sharing the module and some instructions on how to load it?

Thanks,

Joe

11

Re: Time of day

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.

The only true wisdom is in knowing you know nothing. -Socrates

12

Re: Time of day

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)

"The single biggest problem in communication is the illusion that it has taken place."
                                                                                        - George Bernard Shaw

13

Re: Time of day

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

The only true wisdom is in knowing you know nothing. -Socrates

14

Re: Time of day

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

15

Re: Time of day

Amen, but he was a quick learner.  (And may soon be winning the "most posts" contest).

Make it intuitive, never leave them guessing.

16

Re: Time of day

Fergy wrote:

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!

Josh Millward
Burnt Orange Studios

17

Re: Time of day

phils wrote:

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.

Josh Millward
Burnt Orange Studios

18

Re: Time of day

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.

19

Re: Time of day

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.