I have an application that creates log files with names based on the current time. To avoid problems with DST changes I want to use UTC. Here's the code I'm now using:
/*
* This thread rotates the log files every half hour.
*/
static void
logFileRotater(void *arg)
{
epicsTimeStamp now;
struct tm tm;
unsigned long nsec;
int idx;
for (;;) {
epicsTimeGetCurrent(&now);
epicsTimeToGMTM(&tm, &nsec, &now);
epicsTimeFromTM(&now, &tm, nsec);
idx = (logNameIndex + 1) % LOGNAME_COUNT;
epicsTimeToStrftime(logName[idx], sizeof logName[0], "%F_%T", &now);
logNameIndex = idx;
epicsThreadSleep(IRM_LOGFILE_DURATION);
}
}
This works, but swapping back and forth between time representations like that seems a little clumsy. Is there a better approach I could use to convert an EPICS time stamp into a UTC date and time?
Thanks,
--
Eric Norum
[email protected]
- Replies:
- Re: Question about time formatting Maren Purves
- Navigate by Date:
- Prev:
Stay in touch with me through LinkedIn Santosh Aditya
- Next:
Re: Question about time formatting Maren Purves
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Stay in touch with me through LinkedIn Santosh Aditya
- Next:
Re: Question about time formatting Maren Purves
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|