![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| epoch time | ali560045 | Shell Programming and Scripting | 3 | 06-02-2008 01:41 AM |
| epoch time in shell script | robsonde | SUN Solaris | 12 | 04-07-2008 08:04 PM |
| Get real value from real-time systems | iBot | Complex Event Processing RSS News | 0 | 01-13-2008 10:10 PM |
| Epoch time | 12yearold | UNIX for Advanced & Expert Users | 2 | 07-14-2006 12:11 PM |
| Epoch time | 12yearold | Shell Programming and Scripting | 1 | 07-14-2006 08:57 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
EPOCH to real time?
hi all
i am wondering if there is a way to convert from EPOCH time to the standard tim, may be using a script or some thing else??????? thanks............................ |
| Forum Sponsor | ||
|
|
|
|||
|
C example:
Code:
#include <time.h>
#include <stdio.h>
/******************************************************
* to_real_date()
* parms: sec =epoch time
* dest =string to store result
* len =len of string (# bytes)
* convert sec in epoch time to standard data & time
*******************************************************/
char *to_real_date(char *dest, time_t sec, size_t len)
{
/* %c format = std date and time */
size_t result=strftime(dest,len,"%c",localtime(&sec));
if(result==0)
{
*dest=0x0;
}
return dest;
}
int main()
{
char tmp[80]={0x0};
printf("1111256774 seconds into the epoch = %s\n", to_real_date(tmp, 1111256774, 80));
return 0;
}
|