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 | 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 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: EPICS_TIMEZONE and TZ on RTEMS |
From: | Michael Davidsaver <[email protected]> |
To: | Matt Rippa <[email protected]> |
Cc: | Talk EPICS Tech <[email protected]> |
Date: | Tue, 26 Apr 2016 07:56:01 -0400 |
Matt,
Could you try the attached patch for Base? It adds an iocsh function zoneset(). For US eastern time I can use 'zoneset("EST5EDT")' and see the change reflected in generalTimeReport(). Michael On 04/25/2016 07:13 PM, Matt Rippa wrote:
|
>From d196a5e336ea5672ca7a369346b6976b99e3f5f7 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver <[email protected]> Date: Tue, 26 Apr 2016 07:49:17 -0400 Subject: RTEMS: add zoneset iocsh function --- src/RTEMS/base/rtems_init.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/RTEMS/base/rtems_init.c b/src/RTEMS/base/rtems_init.c index e89006b..ebbe9a0 100644 --- a/src/RTEMS/base/rtems_init.c +++ b/src/RTEMS/base/rtems_init.c @@ -433,6 +433,23 @@ static void nfsMountCallFunc(const iocshArgBuf *args) } #endif +void zoneset(const char *zone) +{ + if(zone) + setenv("TZ", zone, 1); + else + unsetenv("TZ"); + tzset(); +} + +static const iocshArg zonesetArg0 = {"zone string", iocshArgString}; +static const iocshArg * const zonesetArgs[1] = {&zonesetArg0}; +static const iocshFuncDef zonesetFuncDef = {"zoneset",1,zonesetArgs}; +static void zonesetCallFunc(const iocshArgBuf *args) +{ + zoneset(args[0].sval); +} + /* * Register RTEMS-specific commands */ @@ -443,6 +460,7 @@ static void iocshRegisterRTEMS (void) #ifndef OMIT_NFS_SUPPORT iocshRegister(&nfsMountFuncDef, nfsMountCallFunc); #endif + iocshRegister(&zonesetFuncDef, &zonesetCallFunc); } /* -- 2.1.4