Solved

Displaying the time on unix using C

Posted on 1998-06-16
3
152 Views
Last Modified: 2010-04-15
I've been using localtime() to display the time on a Sun Workstation (Solaris 5.X) but I don't get the right time. The time that I get on the tm structure is 11/31/69. Note that I use the clock() function to retrieve the time_t structure needed by localtime(). So it my be the clock() function that is not working.
0
Comment
Question by:doscar
3 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1251237
#include <time.h>

 time_t t;
 t = time(NULL);
 printf("%s",asctime(localtime(&t)));
0
 
LVL 4

Accepted Solution

by:
sganta earned 70 total points
ID: 1251238
you can display using
system(date);
0
 

Author Comment

by:doscar
ID: 1251239
Hey guys, The answer that I was looking for was given by ozo. So I was wandering how would I be able to grade his answer. Now, if ozo doesn't mind I'm willing to grade sganta answer.

 
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.

805 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question