1. Date and time program
- Posted by Matt Z Nunyabidness <matt1421 at JUNO.COM> Sep 25, 1998
- 590 views
Here. Dt.ex: include graphics.e include get.e object dl,dly global procedure beep() dly=date() dly=dly[6] dl=date() dl=dl[6] while dl=dly do dl=date() dl=dl[6] sound(1000) end while sound(0) end procedure sequence dt object hour object min object sec object ampm object mo clear_screen() while get_key()=-1 do text_color(4) position(1,1) puts(1," Sun Mon Tue Wed Thu Fri Sat") dt=date() if not compare(1,dt[7]) then text_color(12) position(1,2) puts(1,"Sun") end if if not compare(2,dt[7]) then text_color(12) position(1,6) puts(1,"Mon") end if if not compare(3,dt[7]) then text_color(12) position(1,10) puts(1,"Tue") end if if not compare(4,dt[7]) then text_color(12) position(1,14) puts(1,"Wed") end if if not compare(5,dt[7]) then text_color(12) position(1,18) puts(1,"Thu") end if if not compare(6,dt[7]) then text_color(12) position(1,22) puts(1,"Fri") end if if not compare(7,dt[7]) then text_color(12) position(1,26) puts(1,"Sat") end if position(3,1) hour=dt[4] min=dt[5] sec=dt[6] if hour>12 then hour=hour-12 ampm=" pm" else ampm="am" end if if not compare(0,hour) and not compare(min,0) and not compare(sec,0) then hour=12 beep() end if if not compare(12,hour) and not compare(min,0) and not compare(sec,0) then ampm="pm" beep() end if text_color(14) printf(1," %d:%d:%d %s ",{hour,min,sec,ampm}) position(1,30) mo=dt[2] text_color(15) if mo=1 then puts(1,"January ") elsif mo=2 then puts(1,"February ") elsif mo=3 then puts(1,"March ") elsif mo=4 then puts(1,"April ") elsif mo=5 then puts(1,"May ") elsif mo=6 then puts(1,"June ") elsif mo=7 then puts(1,"July ") elsif mo=8 then puts(1,"August ") elsif mo=9 then puts(1,"September") elsif mo=10 then puts(1,"October ") elsif mo=11 then puts(1,"November ") elsif mo=12 then puts(1,"December ") end if text_color(14) printf(1," %d, 19%d",{dt[3],dt[1]}) end while position(4,1) I think Euphoria programs run horribly slow in a DOS box. Have you ever noticed, that in a DOS box the cursor's color is the opposite of the background, but in full screen/pure dos mode, the cursor's color is the same color as the foreground? ------------------------------------- When it comes to programming languages, Euphoria is a cut above - matt1278 at juno.com and matt1421 at juno.com(and soon to be irisnmatt at prodigy.net. Then again, maybe not) Euphoria programmer
2. Re: Date and time program
- Posted by Hawke <mdeland at NWINFO.NET> Sep 25, 1998
- 577 views
Matt Z Nunyabidness wrote: > I think Euphoria programs run horribly slow in a DOS box. ummmm.... i think you need to adjust your pif settings... badly... if i write a program, benchmark it in pure dos, and in a dos box (with the pif as i have it), i *might* get a 5% difference in speed... tops. >Have you ever noticed, that in a DOS box the cursor's >color is the opposite of the background, but in full >screen/pure dos mode, the cursor's color is the >same color as the foreground? here i think you're confusing pure dos, full screen and dos box. pure dos is when you reboot, (and if you don't already have it showing automatically) you hit f8 to get the bootmenu, choose 5 to step thru each line of your config/autoexec (always do that cuz if you don't you will have ifshelp and setver loaded and they are basically worthless tsr's to have loaded while in *pure* dos) and answer y/n to all the questions and when you are done, you are in *pure* dos mode, no windoze around anywhere at all. fullscreen and dos box are the same. you are entering dos thru a pif while running windows. the only difference is whether the activites that take place are to be shown in a windows or full screen. now that we are cooking with similar terminology, if you are having trouble while running under a dos box, be it windowed or fullscreen, once again, you have setting problems somewhere. if you load ansi.sys, try seeing what your prompt string is, that may be causing a few potential glitches when switching from windowed to full screen under a dosbox. --Hawke'
3. Re: Date and time program
- Posted by irv at ELLIJAY.COM Sep 25, 1998
- 541 views
On Fri, 25 Sep 1998 13:58:28 -0400, Matt Z Nunyabidness <matt1421 at JUNO.COM> wrote: >Here. Dt.ex: <snip> No offense intended; your code works fine. Just for comparison, a more Euphorish way to write it might be: include graphics.e include file.e constant YEAR = 1, MONTH = 2, DAY = 3, HOUR = 4, MIN = 5, SEC = 6, DOW = 7 sequence dt, ampm, days, months days = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"} months = {"January","February","March","April","May","June", "July","August","September","October","November","December"} atom sec, -- holds previous sec hour clear_screen() sec = 0 while get_key() = -1 do dt = date() if dt[SEC] != sec then -- wait for next 1 second update for i = 1 to 7 do -- print days of the week position(1,i*4-3) if i = dt[DOW] then -- print today in another color text_color(YELLOW) else text_color(RED) end if puts(1,days[i]) end for if dt[HOUR] > 12 then ampm=" pm" hour = dt[HOUR] - 12 else ampm=" am" hour = dt[HOUR] end if text_color(BRIGHT_WHITE) position(2,1) printf(1,"%s %02d, %d",{months[dt[MONTH]],dt[DAY],dt[YEAR]+1900}) -- in year 2000, dt[YEAR] will be 100, so you can't just use -- a format string beginning with 19__ text_color(CYAN) position(3,1) printf(1,"%02d:%02d:%02d%s",{hour,dt[MIN],dt[SEC],ampm}) sec = dt[SEC] -- update the seconds end if end while
4. Re: Date and time program
- Posted by Matt Z Nunyabidness <matt1421 at JUNO.COM> Sep 25, 1998
- 542 views
thx for the "Euphoric" way. good optomization. ------------------------------------- When it comes to programming languages, Euphoria is a cut above - matt1278 at juno.com and matt1421 at juno.com(and soon to be irisnmatt at prodigy.net. Then again, maybe not) Euphoria programmer ___________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]
5. Re: Date and time program
- Posted by Matt Z Nunyabidness <matt1421 at JUNO.COM> Sep 26, 1998
- 562 views
- Last edited Sep 27, 1998
i know the difference between pure dos, full screen, and dos box ------------------------------------- When it comes to programming languages, Euphoria is a cut above - matt1278 at juno.com and matt1421 at juno.com(and soon to be irisnmatt at prodigy.net. Then again, maybe not) Euphoria programmer ___________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]