Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Newbie Q: System time?

 [1/6] from: kimm2::mcmaster::ca at: 24-Jun-2002 15:56


I'm trying to grab the current date and time from the system, but I seem to be having trouble. There are examples on the REBOL site that use now/time, but that doesn't seem to work for me. I get this:
>> print now/time
time Your help is greatly appreciated, Matt

 [2/6] from: sunandadh:aol at: 24-Jun-2002 16:30


Matt:
>>> print now/time > time
Welcome to Rebol! That code all looks correct -- except the result is wrong. Have you accidentally redefined 'now as something else, eg: now: "time" Check by using the 'source command: source now An unaltered 'now has this source:
>> source now
now: native [ "Returns the current local date and time." /year "Returns the year only." /month "Returns the month only." /day "Returns the day of the month only." /time "Returns the time only." /zone "Returns the time zone offset from GMT only." /date "Returns date only." /weekday {Returns day of the week as integer (Monday is day 1).} /precise "Use nanosecond precision" ] Also, stop yourself accidentally redefining system words (if that is what you have done), by putting: protect-system in your user.r. And if it isn't that, I'm left puzzled, Sunanda.

 [3/6] from: gscottjones:mchsi at: 24-Jun-2002 16:20


From: Sunanda
<snip> > That code all looks correct -- except the result is wrong.
<<quoted lines omitted: 16>>
> ] > Also, stop yourself accidentally redefining system words (if that is what
you
> have done), by putting: > > protect-system > > in your user.r.
Hi, Matt, In addition to what Sunanda said, if you have accidentally redefined a word, simply restart a new REBOL session and everything will be corrected. If you decide to use the "protect-system" option, you will also need to restart REBOL before the changes will take effect. user.r is run upon first starting up. Other scripts can also be run at start up if desired by including something like: do %my-startup-code.r after the exisiting code in the file. Of course, the my-startup-code.r file will need to be stored in the same directory! :-0 :-) Have fun, but be forwarned that REBOL is very, very addictive! --Scott Jones

 [4/6] from: carl:cybercraft at: 25-Jun-2002 9:19


On 25-Jun-02, Matthew Kim wrote:
> I'm trying to grab the current date and time from the system, but I > seem to be having trouble.
<<quoted lines omitted: 3>>
>>> print now/time > time
Well, it should work...
>> print now/time
9:15:21 My only thought is that while trying to get it working you've altered something about 'now. Try closing down REBOL and starting it again. If that doesn't work, well, I don't know... -- Carl Read

 [5/6] from: kimm2:mcmaster:ca at: 24-Jun-2002 19:49


That was exaclty it! Thanks!!!

 [6/6] from: g:santilli:tiscalinet:it at: 25-Jun-2002 2:53


Hi Matthew, On Monday, June 24, 2002, 9:56:29 PM, you wrote: MK> I get this:
>>> print now/time
MK> time You probably redefined NOW or PRINT. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted