osaf/libs/core/common/logtrace.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)


Calling tzset() for each trace creates a lot of overhead - taking locks,
reading from file etc. This seems unneccessary just for supporting changed
time zones which should be a very rare and one time event at system
installation.

The tzset() call is moved to logtrace init.

diff --git a/osaf/libs/core/common/logtrace.c b/osaf/libs/core/common/logtrace.c
--- a/osaf/libs/core/common/logtrace.c
+++ b/osaf/libs/core/common/logtrace.c
@@ -93,7 +93,6 @@ static void output(const char *file, uns
 
        /* Create a nice syslog looking date string */
        gettimeofday(&tv, NULL);
-       tzset();
        tstamp_data = localtime_r(&tv.tv_sec, &tm_info);
        osafassert(tstamp_data);
        
@@ -180,6 +179,8 @@ int logtrace_init(const char *_ident, co
        pathname = strdup(_pathname);
        category_mask = _mask;
 
+       tzset();
+
        if (_mask != 0) {
                trace_fd = open(pathname, O_WRONLY | O_APPEND | O_CREAT, 
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
                if (trace_fd < 0) {

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to