[yocto] Yocto uses UTC time for DATETIME instead of localtime

Davis Roman davis.roman84 at gmail.com
Sun Feb 11 20:24:07 PST 2018


Hi Trevor,

Thank you for taking the time to reply.

You are correct. I did ask this question this question before and
unfortunately the issue is not so much that the answer was incorrect but
that I realized that the answer did not entirely fix my original problem in
a global manner. ( BTW, I acknowledge that I should have asked the question
in this manner to begin with instead of just asking the same question all
over again. My apologizes.)

So the solution that I last received was the following:



*You can try to add this to conf/local.conf or redefine it in os-release.bb
<http://os-release.bb/>:BUILD_ID = "${@time.strftime('%Y-%m-%d
%H:%M:%S',time.localtime())}"*


And this did in fact produce a BUILD_ID in /etc/os-release that reflected
my local time however I later realized that the swu files produced by my
swupdate image recipe was still using the GMT version of DATETIME. This
lead me to believe that the original fix was not global enough and so
swupdate called DATETIME again and it got the GMT version.

And so I was worse off than before because my builds were producing
artifacts with timestamps that made it confused for my application
developers so I ended up removing the original fix in order to, at the very
least, have timestamps that were consistent.


After a bit of diggigin, i see that in poky/meta/conf/bitbake.conf,
DATETIME is defined as follows:

155 ##################################################################
156 # Date/time variables.
157 ##################################################################
158
159 DATE := "${@time.strftime('%Y%m%d',time.gmtime())}"
160 TIME := "${@time.strftime('%H%M%S',time.gmtime())}"
161 DATETIME = "${DATE}${TIME}"

I recall trying to putting the following my local.conf hoping this would
make the change global but it didn't seem to work.

DATE := "${@time.strftime('%Y%m%d',time.localtime())}"
TIME := "${@time.strftime('%H%M%S',time.localtime())}"


Can you suggest a different way of making this change?

Thank you,

Davis


On Sun, Feb 11, 2018 at 10:12 PM, Trevor Woerner <twoerner at gmail.com> wrote:

> On Sun, Feb 11, 2018 at 7:30 PM, Davis Roman <davis.roman84 at gmail.com>
> wrote:
>
>> I'm using the DATETIME variable to generate timestamps for my final
>> images however I see that yocto is using UTC time.
>>
>> I'd much prefer if yocto used localtime.
>>
>> Any suggestions on how to change this?
>>
>>
> You asked this same question almost exactly a month ago, and it was
> answered then. Was there something wrong with that answer?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20180211/0dab2d72/attachment.html>


More information about the yocto mailing list