[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200416023219.GA30641@jagdpanzerIV.localdomain>
Date: Thu, 16 Apr 2020 11:32:19 +0900
From: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
linux-kernel@...r.kernel.org,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Andrew Morton <akpm@...ux-foundation.org>,
Hans Verkuil <hverkuil@...all.nl>,
Jonathan Corbet <corbet@....net>,
Alexandre Belloni <alexandre.belloni@...tlin.com>
Subject: Re: [PATCH v3 1/3] lib/vsprintf: Print time64_t in human readable
format
On (20/04/15 20:00), Andy Shevchenko wrote:
[..]
> #include <linux/of.h>
> #include <net/addrconf.h>
> @@ -1819,6 +1820,29 @@ char *rtc_str(char *buf, char *end, const struct rtc_time *tm,
> return buf;
> }
>
> +static noinline_for_stack
> +char *time64_str(char *buf, char *end, const time64_t time,
> + struct printf_spec spec, const char *fmt)
> +{
> + struct rtc_time rtc_time;
> + struct tm tm;
> +
> + time64_to_tm(time, 0, &tm);
> +
> + rtc_time.tm_sec = tm.tm_sec;
> + rtc_time.tm_min = tm.tm_min;
> + rtc_time.tm_hour = tm.tm_hour;
> + rtc_time.tm_mday = tm.tm_mday;
> + rtc_time.tm_mon = tm.tm_mon;
> + rtc_time.tm_year = tm.tm_year;
> + rtc_time.tm_wday = tm.tm_wday;
> + rtc_time.tm_yday = tm.tm_yday;
> +
> + rtc_time.tm_isdst = 0;
Here you convert time64_t (signed, we also have unsigned version - timeu64_t)
to tm first and then convert tm to rtc_time. Will rtc_time64_to_tm() do the
trick?
-ss
Powered by blists - more mailing lists