Aller au contenu

Photo

getting the real day and time


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
acomputerdood

acomputerdood
  • Members
  • 219 messages
my module restarts every 12 hours from a cronjob, and i want it to keep track if it's currently running in the AM or PM mode (and the day of the month).  i'm using nwnx.

my ideas so far:
- have a way for the linix cronjob to pass a flag or variable that OnModuleLoad can read.  i'm using nwnx, but i'm not aware of a function to do this.  ideas?
- capture a "say" command from the console.  is that even possible?  nwnx_chat might be able to do it, no?
- use OnModuleLoad to call GetTimeHour to determine AM or PM.  but i didn't see a function to get the real-life calendar day.

there has to be an easy way to do this, right?  what am i missing here?

#2
acomputerdood

acomputerdood
  • Members
  • 219 messages
nwnx_funcs has GetTimeOfDay() which returns system time in seconds.  again, that won't give me the day or month.  :(

Modifié par acomputerdood, 04 avril 2013 - 11:21 .


#3
acomputerdood

acomputerdood
  • Members
  • 219 messages
ahhh, this is a workable solution. nwnx_system has FileReadAll() which will read in the contents of a file from the system.

this way i can use my cronjob to set whatever string i want. much easier.


still curious about other solutions, though.

#4
CaveGnome

CaveGnome
  • Members
  • 290 messages
Hello,

Perhaps, if you don't mind atomic precision, you just can convert system time (or game time using the scale coefficient) seconds in hours, days, months, years and have an initial date & hour reference entered manually to fix the starting point init. But the FileReadAll() seems a better approach if you can grab directly the system time (disclaimer, i don't use nwnx).

#5
virusman

virusman
  • Members
  • 282 messages
You can use SQL time functions if you're using NWNX database plugin.