1. time
- Posted by Kat <gertie at ZEBRA.NET> Feb 02, 2000
- 464 views
- Last edited Feb 03, 2000
Errr, i can't find how to set time() in the Eu docs.... is it possible? Syntax: a = time() Description: Return the number of seconds since some fixed point in the past. *What* fixed point? If someone uses this in dos at 23:59 after it's started, and calls it again in 20 minutes to time a duration,, they'll get an error. Can it be reset to 0 in dos or win95? Kat
2. Re: time
- Posted by JJProg at CYBERBURY.NET Feb 03, 2000
- 445 views
EU>Errr, i can't find how to set time() in the Eu docs.... is it possible? EU>Syntax: a = time() EU>Description: Return the number of seconds since some fixed point in the EU>past. EU>*What* fixed point? If someone uses this in dos at 23:59 after it's started, EU>and calls it again in 20 minutes to time a duration,, they'll get an error. EU>Can it be reset to 0 in dos or win95? EU>Kat I don't know of any way to set the time in Euphoria. Also, the fixed point seems to be the first call to time() (it always returns 0 the first time you call it). Jeff
3. Re: time
- Posted by Robert Craig <rds at ATTCANADA.NET> Feb 04, 2000
- 463 views
Kat writes: > Errr, i can't find how to set time() in the Eu docs.... is it possible? There's a DOS interrupt for this. See doswrap.e in the Jacques Deschenes Collection. In Windows, Jesus Consuegra has a program in the Archive that sets your computer's time. He gets the time from a special site on the Internet. > Syntax: a = time() > Description: Return the number of seconds since some > fixed point in the past. > > *What* fixed point? You are supposed to use time() to measure differences in time. I don't guarantee that it will always start at 0 on all versions of DOS, Windows and Linux. You can set a variable: start_time = time() and then measure the difference from that. If you want the time of day (to the second), use Euphoria's date() routine. > If someone uses this in dos at 23:59 > after it's started, and calls it again in 20 minutes to time > a duration,, they'll get an error. There's no problem crossing the midnight boundary, but you can't (easily) time something that takes longer than 24 hours. > Can it be reset to 0 in dos or win95? No. Just set start_time = time() again. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
4. Re: time
- Posted by Kat <gertie at ZEBRA.NET> Feb 03, 2000
- 450 views
----- Original Message ----- From: Robert Craig <rds at ATTCANADA.NET> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Friday, February 04, 2000 1:28 PM Subject: Re: time > Kat writes: > > Errr, i can't find how to set time() in the Eu docs.... is it possible? > > There's a DOS interrupt for this. See > doswrap.e in the Jacques Deschenes Collection. > > In Windows, Jesus Consuegra has a program in the Archive > that sets your computer's time. He gets the time > from a special site on the Internet. I don't want to reset the *computer's* time, just this arbitrary time-thing. > > Syntax: a = time() > > Description: Return the number of seconds since some > > fixed point in the past. > > > > *What* fixed point? > > You are supposed to use time() to measure > differences in time. I don't guarantee that it will always > start at 0 on all versions of DOS, Windows and Linux. > You can set a variable: start_time = time() > and then measure the difference from that. > If you want the time of day (to the second), > use Euphoria's date() routine. Mine didn't return 0 the first call either, it is called quite soon after the program starts, and returns 0.4 or so. Seems to me if i must use dos interrupts, there are better ones to use where i am now using time(), ints that don't suffer the 24hr reset that time() does. > > If someone uses this in dos at 23:59 > > after it's started, and calls it again in 20 minutes to time > > a duration,, they'll get an error. > > There's no problem crossing the midnight boundary, > but you can't (easily) time something that takes > longer than 24 hours. > > > Can it be reset to 0 in dos or win95? > > No. Just set start_time = time() again. Hmm,, if i use my own time() function, i can set/return from those better dos interrupts... seems i did see something in the archives under timers() that called these ints. Doing a time(0) would simply set a Var to current ticks since epoch, and the next call to time() would return the NowCurrentTicks minus Var. /me looks up Jesus,, which (believe me) is against her religion, lol. Any idea of the performance hit for dos calls under windoze? > Regards, > Rob Craig Hi Rob! Kat
5. Re: time
- Posted by Robert Craig <rds at ATTCANADA.NET> Feb 03, 2000
- 445 views
- Last edited Feb 04, 2000
Kat writes: > Any idea of the performance hit for dos calls under windoze? You can't do DOS interrupt calls using WIN32, i.e. exw.exe. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
6. Re: time
- Posted by Kat <gertie at ZEBRA.NET> Feb 03, 2000
- 445 views
- Last edited Feb 04, 2000
----- Original Message ----- From: Robert Craig <rds at ATTCANADA.NET> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Thursday, February 03, 2000 7:14 PM Subject: Re: time > Kat writes: > > Any idea of the performance hit for dos calls under windoze? > > You can't do DOS interrupt calls using WIN32, i.e. exw.exe. sigh Kat, making a loud ARRRGGGGG sound.
7. Re: time
- Posted by CenSe <cense at MAIL.RU> Feb 04, 2000
- 446 views
when you run: atom a, b, total a = time() -- do something b = time() total = b - a then total equals the amount of time that alrorithm where the comment -- do something took to execute. i do not know the exact internals of the time() function but you dont have to get it to work for you, you just have to make two calls to time() and subtract the second call of time() from the first. CenSe, a member of the ak-software development team http://ak-software.virtualave.net/
8. time
- Posted by Kat <gertie at PELL.NET> Aug 08, 2002
- 465 views
<embarassed look> I forgot how the email thread about converting machine time to human time ended. Given: 1028458790 how to convert to: Sun Aug 04 05:59:50 2002 ? Kat
9. Re: time
- Posted by "Carl W." <euphoria at cyreksoft.yorks.com> Aug 08, 2002
- 438 views
Kat wrote: > <embarassed look> > I forgot how the email thread about converting machine time to human time > ended. If it was a Windows thread I may have skipped it. Chances are there's something in the Windows API that'll do it. Otherwise <product plug mode on>... > Given: > 1028458790 > > how to convert to: > Sun Aug 04 05:59:50 2002 This looks like the 'Number of seconds since 1-1-1970' format. I wrote a library last year that handles this and a few other date and time handling routines. The following link will search for it at RapidEuphoria.com (should be all on one line): http://www.rapideuphoria.com/cgi-bin/asearch.exu?gen=on&keywords=Carl+White+ datetime The only real bug with the library that I know of is that there's a spurious 'with trace' in the .e file itself... Carl
10. Re: time
- Posted by Kat <gertie at PELL.NET> Aug 08, 2002
- 457 views
On 8 Aug 2002, at 9:42, Carl W. wrote: > > Kat wrote: > > > > <embarassed look> > > I forgot how the email thread about converting machine time to human time > > ended. > > If it was a Windows thread I may have skipped it. Chances are there's > something in the Windows API that'll do it. > Otherwise <product plug mode on>... > > > Given: > > 1028458790 > > > > how to convert to: > > Sun Aug 04 05:59:50 2002 > > This looks like the 'Number of seconds since 1-1-1970' format. > > I wrote a library last year that handles this and a few other date and time > handling routines. Yes, i looked at it intently, before emailing, and saw nothing to do what i outlined above. There is a converter to go from seconds to year and day- count, but in the example you gave, i don't see how day 357 = xmas. How isn't it the day before or after? How do i get the day (1,2,3 etc or mon, tues etc) and month (1,2,3 etc or jan feb etc)? Kat
11. Re: time
- Posted by "Carl W." <euphoria at cyreksoft.yorks.com> Aug 08, 2002
- 445 views
Kat wrote: > Yes, i looked at [datetime.e] intently, before emailing, and saw nothing > to do what i outlined above. There is a converter to go from seconds to > year and day-count, but in the example you gave, i don't see how day 357 > = xmas. How isn't it the day before or after? How do i get the day (1,2,3 > etc or mon, tues etc) and month (1,2,3 etc or jan feb etc)? True, a function that does exactly what you need isn't in datetime.e. I had to make a trade-off between usefulness and number of functions when I was writing the library, just like the (sensible IMHO) trade-offs Rob C. makes every time he releases a new version of Euphoria. What would be the point of programming if every subroutine you needed was already written? We could just call "do_what_I_mean(x)" :) Here's some code to get you started: ----- include datetime.e constant given = 1028458790 DateTime converted atom seconds -- First we need to convert a number of 'seconds-since-Epoch-1970' to -- datetime.e's internal seconds format -- => seconds since Midnight, 1st Jan 1AD = Date_0 seconds = EpochTo1ADTime(given) -- it's this easy. -- Now we need to conver the base number-of-seconds into a proper date -- and time. converted = secondsToDateTime(seconds) -- and we're done. -- You could even roll them into one line, like so: converted = secondsToDateTime(EpochTo1ADTime(given)) ----- With any luck 'converted' now contains {{2002,8,4},{5,59,50}}. To get the day of the week, we can do this: ----- -- dayOfWeek takes an object of type Date, so we access the Date portion of -- the converted DateTime with the DT_DATE constant. integer dow dow = dayOfWeek(converted[DT_DATE]) ----- Thinks: In hindsight, maybe it would have been nice to allow dayOfWeek() to accept either a Date or a DateTime... Hmm. As for Xmas being day 359... Well in most years it _is_ the 359th day of the year. In leap years it's the 360th. Anyway, I hope that helped some, :) Carl PS It's so long since I wrote the library that I actually had to read the datetime docs to compose this reply!