Solved

Displaying the time on unix using C

Posted on 1998-06-16
3
151 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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

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

Suggested Solutions

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

896 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now