Skip to content

Add function to convert between calendar time and broken-down time for universal use

Zhaolei lkml 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 0 repliesNew
  2. v32 patches 12 repliesSuperseded
  3. v22 patches 10 repliesSuperseded

Changes in v4 from the cover letter

1: Use long instead of int for tm.tm_year to avoid overflow 2: Remove localtime() and gmtime() because they can't support timezone
database as user-more. And rename __offtime() to time_to_tm()
3: Use time_t instead of __kernel_time_t as function's argument type 4: __isleap(unsigned int year)->__isleap(long year) to avoid overflow

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Add function to convert between calendar time and broken-down time for universal useinclude/linux/time.h kernel/time/Makefile kernel/time/timeconv.c+156 -10 replies
2/2Use common time_to_tm in fat_time_unix2fat()fs/fat/misc.c+15 -420 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/2] Add function to convert between calendar time and broken-down time for universal use

Hello, Andrew

This is Patch v4.
I updated this patch bases on Ogawa-san's suggestion.

Changelog v3->v4:
1: Use long instead of int for tm.tm_year to avoid overflow 2: Remove localtime() and gmtime() because they can't support timezone
database as user-more. And rename __offtime() to time_to_tm()
3: Use time_t instead of __kernel_time_t as function's argument type 4: __isleap(unsigned int year)->__isleap(long year) to avoid overflow

Changelog v2->v3:
Using a struct to save year/mon/.../yday.

Changelog v1->v2:
1: Fix "no tabs" error caused by email client.
2: Remove explicit 'inline' in __isleap()
3: Move DIV() and LEAPS_THRU_END_OF(y) into regular C function along with
comment
4: Move gmtime() and localtime() into header file.

Thanks
Zhaolei