EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Question about time formatting
From: Maren Purves <[email protected]>
To: Eric Norum <[email protected]>
Cc: EPICS Tech-Talk <[email protected]>
Date: Mon, 14 Jan 2013 11:29:55 -1000
Something like this?

strftime(filename, sizeof(filename),
                    "/%Y%m%d/", gmtime( &now ) )

(we're reusing the filename here, this part is the UT date.
It really is
length=strftime etc.)

Aloha,
Maren

Eric Norum wrote:
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,




References:
Question about time formatting Eric Norum

Navigate by Date:
Prev: Question about time formatting Eric Norum
Next: problem about edm widget Silver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Question about time formatting Eric Norum
Next: problem about edm widget Silver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·