×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

A question about the clock.

A question about the clock.

A question about the clock.

(OP)
Hello,
I am translating a book for my class "How programming started ..." from English to Spanish. However, I did not answer a question from a student.

A week ago, during a dBase brush up; while we were examining ASSIST, he asked me: "how does the clock works continuously" referring to a clock put at the beginning of the page which, with the program not working, showed the actual time running the hour, minutes and seconds.
I was afraid of this question; I had already examined the code, but without results and the book I had was very frugally with the matter.
I couldn't answer the question. sad

Is there someone who can help me with the dBase code for this watch?

Thanks very much.

RE: A question about the clock.

(OP)
Nobody? sad

RE: A question about the clock.

Hi Rosciano,
When you say Clock, I assume you are referring to the time function.
At the dot prompt type ? TIME()
or as follows:-

. ? time()
you will then see the time displayed.

Phil Thoms

RE: A question about the clock.

(OP)
I knew the funtion TIME(), it returns the system time in a string of characters: "hh: mm: ss", but it is static, it does not move.
I would like to continue giving the time without having to ask again.

Example:
"hh: mm: 01"
"hh: mm: 02"
"hh: mm: 03"
...and so on

RE: A question about the clock.

Hi,
I think you have to get the time from the server, but I need to look into this further.

RE: A question about the clock.

(OP)
I tried with different dBase codes, but none worked:

One example:

do while .not. eof()
store substr(time(),1,8) to waa
@ 24,70 say waa
enddo

I hope you find the correct code...

RE: A question about the clock.

(OP)
This code also works, but it doesn't let me go further...

ct=0
do while ct<>1
store substr(time(),1,8) to waa
@ 24,70 say waa
enddo

RE: A question about the clock.

Your coding won't work as a continuous time because it will only be activated once when you run your program.
I assume you are using Dbase III plus. If so the time always appears in the top right hand corner of the screen in the assistant menu as it used to be called.

Dbase III plus therefore uses the system settings for this purpose.

Phil T

RE: A question about the clock.

(OP)
Yes, I am using dBase III Plus v1.1. The time indeed appears in the top right hand corner of the screen in the Assistant Menu.
I tried to convert TIME()in a normal variable, but nothing, same thing.

Since time() is a function whose result is a string of characters ("hh:mm:ss"), why not take advantage of this condition and use the string?

RE: A question about the clock.

Hi,
Set Clock on and set clock to (position on screen) was introduced in the first windows version of dBase. I used dBase III plus for a short time only and thereafter migrated to FoxPro 2 for DOS and shortly after to FoxPro 2.6 Windows. I currently use Visual FoxPro 6. The FoxPro language is the same as dBase but the updates were far more frequent. I will try to find any useful time() function programs which may be of interest.

RE: A question about the clock.

(OP)
I hope they haven't mixed FoxPro and dBase with the clock...

RE: A question about the clock.

Hi,
The FoxPro updates were more frequent than dBase and the clock settings appeared in the first windows version Dbase 5.


RE: A question about the clock.

(OP)
dBase 5??

RE: A question about the clock.

Yes, dBase 5 or to be more accurate dBase V.

RE: A question about the clock.

To add to my previous post; dBase V was first released in 1994 followed soon after by a Windows version. I think version 8.1 is the latest.

RE: A question about the clock.

(OP)
So, I would better forget it...

RE: A question about the clock.

Hi,
Yes, I think it wise to forget it for now. You could try to get a copy of dBase V.

RE: A question about the clock.

(OP)
You mean that whit dBase V I could find an answer?

I don't explain how they could put a code of dBase V when this didn't exist yet...

ponder

RE: A question about the clock.

A lot of updates were put into dBase V and there was also a Windows version, so yes I think the clock/time parameters were more flexible.

I don't understand your last sentence, please clarify.



RE: A question about the clock.

(OP)
I do not understand how they could put a dBase V code when it (dBase V) did not exist yet ...
Is clear enough?

(Meanwhile, they came to my house to vaccinate me against Covid (I am in a wheelchair))
wink

RE: A question about the clock.

In dBase V it was possible for the user to add the clock to a to an individual program and specify its location on the screen.
The commands for this; Set Clock on or off) and Set Clock to [row, column].
New versions of dBase contained improvements on the previous version; dBase III plus contained commands that dBase III dis not have and dBase III had commands that dBase II did not have, etc. dBase is now up to version 8.1

RE: A question about the clock.

(OP)
Here I have a couple of old (used) books from the "Qsborne / McGraw-Hill", both original from 1977, and in any of them, specifically in Using dBase III Plus, the famous clock already appears on the ASSIST page.

In 1977?

I have no idea when dBase V came out, but surely AFTER dBase III, dBase IV and before they wrote it in these old books, let alone dBase III.
I agree with you that a piece of other software was included, that explains how there is no way to do it with dBase III, but it is not a piece of dBase V.

Come to think of it, I don't think they have mixed software, the code is written in dBase III !, but how?

RE: A question about the clock.

Hi,
You should look into the history of dBase under Ashton Tate (owners).
The following shows approximate dates of new releases for dBase:-
1983 dBase II
1984 dBase III
1986 dBase III plus
1988 dBase IV (versions 1 and 2)
1994 dBase V


All new releases introduced new commands and functions.
I am not sure what you are not understanding about new releases or updates.

RE: A question about the clock.

(OP)
Thank you for the dates.
Anyway, the books I have were printed BEFORE any of those occasions (1977).
How can you be so sure a piece of dBase V was added if you don't even know the code? Do you imagine?
Can you prove it?

RE: A question about the clock.

When the updates were released Ashton Tate would list the new commands/functions with descriptions and examples.
This is what normally happens when updates are released for any software.


RE: A question about the clock.

(OP)
"When the updates were released Ashton Tate would list the new commands/functions with descriptions and examples.
This is what normally happens when updates are released for any software."



OK this is known, but this does not answer my concerns, nor the fact of the dates.
Ashton Tate knew beforehand dBase V ...

RE: A question about the clock.

I do not know what your concerns are. It is a fact that the user cannot move or set the clock on or off in dBase III plus!
What do you mean by Ashton Tate knew beforehand dBase V ... ???

RE: A question about the clock.

(OP)
Thank you very much.
smile


beforehand = at an earlier time
These words mean at an earlier time.

RE: A question about the clock.

I know what beforehand means. How could they know about dBase 5 when dBase III plus was the latest version ??
Just to clarify; many amendments/additions were introduced in dBase 4 and 5 that were not available in 3 plus.
Ask Joe, as he already knows about some of the dBase history.

RE: A question about the clock.

(OP)
Pardon!!
I misread the book's date. The correct date is 1987
I'am sorry... sad






RE: A question about the clock.

Hi Rosciano,
No problem,
we can all misread dates and times etc.

RE: A question about the clock.

(OP)
I did it (without dBase V), of corse, with adding some stuff (how to stop)

CODE -->

*DO.PRG
*
store 0 to ab,ad,ac,cd          && preparing the varibles to be used
waa=' '
*
clear
DO WHILE .T.
    if ad=0
        do while ac=ab
            ab=ab+1
        enddo
        if ac=ab-1
            store substr(time(),1,8) to waa
        endif
        @ 14,36 say WAA 
        cd = inkey()
        if cd <> 0                 && the program stops with any key pressed
            exit
        endif
    endif
ENDDO 

RE: A question about the clock.

Hi Rosciano,
Have you tried this? At first glance it looks okay but I will try it in Visual FoxPro because it uses the same language as dBase and will let you know.

RE: A question about the clock.

Hi Rosciano,
Yes your program works perfectly. It probably needs a clear command before exit, but you may not want to clear the screen for some reason.

RE: A question about the clock.

(OP)
Tried!
It's has worked for two and a half days on one of my applications that I use frequently.

RE: A question about the clock.

Hi Rosciano,
Instead of cd=inkey() etc. you could put the following

If inkey()=27 && user presses escape key
EXIT
endif

RE: A question about the clock.

(OP)
OK thanks, I'll keep it in mind.

RE: A question about the clock.

(OP)
If you notice any "flickers" in the time, add the following:

CODE -->

*
store 0 to ab,ad,ac,cd,CT          && preparing the varibles to be used
waa=' '
*
clear
DO WHILE .T.
    if ad=0
        do while ac=ab
            ab=ab+1
        enddo
        if ac=ab-1
            store substr(time(),1,8) to waa
        endif
        

*-----The number "30" could be "15, 20, 30, 45, 50,..." it depends on how  
*-----much time we want to give it.
        DO WHILE CT<30
            CT=CT+1
        ENDDO
        CT=0
        

        @ 14,36 say WAA 
        cd = inkey()
        if cd <> 0                 && the program stops with any key pressed
            exit
        endif
    endif
ENDDO 


RE: A question about the clock.

Hi,
If I want to add the clock to a program that for example produces an input screen then the exit procedure would have to be modified?
I will try to run this with another program and let you know. Your program is a benefit to users still operating Dbase III plus.

RE: A question about the clock.

(OP)
Good Day,

Next, I show how I inserted it into a program that I use frequently:

CODE -->

CLEAR
    option=' '
    
    set color to n+/b
    @ 24,1 say 'Date:'
    @ 24,6 say date()
    @ 24,65 say 'Hour:'
    set color to gr+/r
    @ 24,30 say ' Press any to Start '
    store 0 to ab,ac,ad,cd,ct
    waa=' '
    DO WHILE .T.
        if ad=0
            do while ac=ab
                ab=ab+1
                set color to n+/b
            enddo
            if ac=ab-1
                store substr(time(),1,8) to waa
            endif
            ac= ab-1
            @ 24,70 say WAA 
            DO WHILE CT<30
                CT=CT+1
            ENDDO
            cd = inkey()
            if cd <> 0
                exit
            endif
        endif
    ENDDO    
    @ 24,1 clear to 24,78
    Set color to w+/b
    @ 24,29 say 'Your Option?:' get option pict '@!'	
    READ 

RE: A question about the clock.

Rosciano,
I have run the above program which changed my Foxpro screen to dark blue bigsmile - but the clock stopped working when the option question appeared.
So it would be good for Dbase III plus to keep the clock running while answering the option question was answered. CD = inkey() seems to get in the way.
However it is a very good step forward for 3 plus. bigsmile

RE: A question about the clock.

(OP)
...but the clock stopped working when the option question appeared...


If the option appears, it means that, for some reason, has left the DO WHILE. I don't know, I would have to watch the program or know more about Foxpro.

You gave me the clue when you said "...be activated once when you run your program..." so this is the reason for the DO WHILE, keep the loop as long as a key is not pressed.

But the mystery of how they do it at ASSIST continues ...


Sorry for the delay answering

RE: A question about the clock.

Hi Rosciano,
Sorry about my delay in responding. The ASSIST may be written in a different language for some reason.
However, I will look into this interesting mystery as soon as possible...

RE: A question about the clock.

(OP)
Good luck! thumbsup2
Get in touch if you find something interesting.

RE: A question about the clock.

Hi,
Not found anything too exciting, but I've done a simpler version of continuous time on screen:-

Do While .T.
@20,30 say time()
@20,40 say 'PRESS ESCAPE TO CLEAR'
if inkey()=27
clear
exit
endif
Enddo

In the meantime I'll keep looking bigsmile

RE: A question about the clock.

(OP)
OK peace

RE: A question about the clock.

(OP)
Keep in mind that in ASSIST it works WITHOUT any key pressed... The watch works from the beginnig ponder
Definitely, it must be written in other language.

RE: A question about the clock.

Hi,
In the early days in dBase and FoxPro some displays like the clock were hard coded where the user was not able to make modifications.
I have seen some of the requests for certain commands/functions to be introduced in the next program update. I remember them bring discussed in various magazines of the time. Still looking3eyes

RE: A question about the clock.

(OP)
The original version was written entirely in language assembly, while the successive version, from dBase III, was written entirely in language C.
Google

Perhaps ASSIST was written in the same language?

RE: A question about the clock.

Hi,
Yes, Foxpro was helped by the C+ language. Probably these are the answers. I have a book of user defined functions from the late 1980s which helped dBase and FoxPro users and was called 101+ FoxPro & dBase user-defined functions by Philip Steele. If you are looking for anything in particular (apart from time stuff) let me know.bigsmile

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close