time clock program


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers time clock program
# 1  
Old 12-03-2003
time clock program

How would you write a program that would continually show the time in HOURS:MINUTES on an ASCII terminal(not just xclock)?
# 2  
Old 12-03-2003
An ascii terminal that you continue to type on? You could write the program using UNIX curses/ansiC. Do a 'man curses'.

Cheers,

Keith
# 3  
Old 12-03-2003
you could also include the time as a PS1 variable to alter your prompt, however this is not continually updated, so your time will not be refreshed until you hit enter.
# 4  
Old 12-04-2003
I'm not sure exactly how you want to use what you're talking about, but you could do something goofy like this (saving the script as "showtime.sh" ):
Code:
#!/bin/sh
clear
date +"%r"
sleep 1
/Users/$USER/bin/showtime.sh

-Cassj

Last edited by cassj; 12-04-2003 at 10:00 PM..
# 5  
Old 12-05-2003
Danger!

Re: cassj's script - might cause system slowdown. The last line will launch a new process without terminating the current process, ie. after ten minutes you will have 600 processes all running showtime.sh.
# 6  
Old 12-05-2003
Data

Thanks Ygor. Sorry if I inadvertently wrote a virus :-( How about this:
Code:
#!/bin/sh
while [ 0 = 0 ] ; do
  clear
  date +"%r"
  sleep 1
done

I'm not a UNIX expert. I guess I know enough to be dangerous ;-P I couldn't find a way yet to make an infinite loop except for something like the "while" statement above. I'm using the default terminal in Mac OS X (10.3.1) Panther. Regards, Cassj
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

C program multiple definition error during linking time

Hi, I have the following files: // file.hvoid foo(); int i = 5; // should be just declared as extern int i; // file1.c#include <stdio.h> #include "file.h" void foo() { i = 10; printf("%d\n", i); } // file2.c#include <stdio.h> #include "file.h" int main() { foo(); (9 Replies)
Discussion started by: royalibrahim
9 Replies

2. Solaris

How to create core through program at the time of crash by handling signals?

I am in process of writing a library which can make any application of my product capable of creating core in the application's log folder with a product friendly core file name programatically. In my library I am registering for certain signals e.g. SIGILL, SIGFPE, SIGBUS, SIGSEGV, SIGSYS, SIGABRT... (5 Replies)
Discussion started by: rajeev_ks
5 Replies

3. AIX

How to create core through program at the time of crash by handling signals?

I am in process of writing a library which can make any application of my product capable of creating core in the application's log folder with a product friendly core file name programatically. In my library I am registering for certain signals e.g. SIGILL, SIGFPE, SIGBUS, SIGSEGV, SIGSYS, SIGABRT... (1 Reply)
Discussion started by: rajeev_ks
1 Replies

4. Programming

PHP Travel Clock based on Mysql Date time

I have date time records in a PHP mysql table, I need a PHP travel clock which obviously counts down, I mean acts like a travel clock, but the clock time should be the date time field value down by the second, based on the full date time, from day to seconds It is not just one record, I... (1 Reply)
Discussion started by: AimyThomas
1 Replies

5. UNIX for Dummies Questions & Answers

Real time of a clock for every 60 seconds in unix

hi can any one guide me on how to display real time of a clock in unix for every 60 seconds (2 Replies)
Discussion started by: ramnadh_babu
2 Replies

6. Shell Programming and Scripting

How to run this program with only one input file at a time

i have a program ABC, which runs every two minutes and takes the input according to the a value called "pointer" files need to be processed by ABC are input0001 input0002 input0003 input0004 input0005 current value of pointer is 0001, now program runs and takes all the files from... (2 Replies)
Discussion started by: Prat007
2 Replies

7. Shell Programming and Scripting

Shell program to accept multiple request at the same time

Hi, I got a script which sends the Email to the user based on certain variables received from Tivoli Server Monitoring 6.1. Now to keep track of the mails I have wrote a stored procedure in DB2 as we use DB2 UDB as back end which take the variables that were used to send the mail and store it... (3 Replies)
Discussion started by: tcskurra
3 Replies

8. UNIX for Advanced & Expert Users

Implementing "Time Limited, Trial" version of my program

Hello everyone, I am just looking for ideas on how I can implement a demo version of my program which will be available in unix environment (solaris and linux). So what I have in mind is to either implement a limited-time version (trial version expires after 30 days) or a limited-number... (4 Replies)
Discussion started by: the_learner
4 Replies

9. Programming

C program in Unix / Linux - Time differences

Hi Friends, When Iam running c program in redhat linux 7.3 version and PCQ Linux 8.0 version, its taking around 20 seconds. But when Iam running it in HP-UX Release 11i, its taking around 3 minutes. Can anyone throw light on this. Thanks in advance, Praveen. (11 Replies)
Discussion started by: chprvkmr
11 Replies

10. Programming

running a program for a specified time

how can i run a program for a specified time? i need to print a current time during program execution. (3 Replies)
Discussion started by: prosputko
3 Replies
Login or Register to Ask a Question