|
Re: [Gumstix-users] gettimeofday()
From: Grahame Jordan <gbj@th...> - 2009-09-29 04:17
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Dave Hylands wrote:
<blockquote
cite="mid:c32efac40909280718g223ba1e3o8af70feddecf71b6@..."
type="cite">
<pre wrap="">Hi Grahame,
</pre>
<blockquote type="cite">
<pre wrap="">In OE using glibC the /etc/TZ variable has no effect upon the result of
gettimeofday(), it comes out as UTC.
If I set the TZ variable: export TZ="UTC-10" date gives me the correct
date but not gettimeofday() still in UTC
</pre>
</blockquote>
<pre wrap=""><!---->
It's my understanding that gettimeofday and time should return the
same value (for the seconds portion), and in both the cases, the time
should be UTC time.
localtime is the function that should respect the timezone setting and
do the conversion.
</pre>
</blockquote>
Yes I am actually using localtime() in the part of my code that gives
me the string representation of the time.<br>
This behaves differently between the uClibC build and the glibC build.<br>
<br>
In glibC if I link /usr/share/zoneinfo/Australia/Melbourne
/etc/localtime it all works<br>
In uClibC all I need to do is put some entry in /etc/TZ such as
"UTC-10" and it works<br>
<br>
The reason I am wanting to use /etc/TZ method is that I can set the
time from the Host OS on the Gumstix by parsing seconds|milliseconds|
tzoffset<br>
The tzoffset I convert to -offsetHours and put that value into /etc/TZ
as UTC${offsetHours} eg. UTC-10 or any other combination of UTC+-XX<br>
<br>
With glibC this seems to make things more complicated. Maybe there is
a simple way with glibC?<br>
<br>
<br>
<br>
<br>
</body>
</html>
|
| Thread | Author | Date | |
|---|---|---|---|
| [Gumstix-users] gettimeofday() | Grahame Jordan <gbj@th...> |
|
|
|
|