• Zhaolei's avatar
    There are many similar code in kernel for one object: convert time between · 35c69d10
    Zhaolei authored
    calendar time and broken-down time.
    
    Here is some source I found:
    fs/ncpfs/dir.c
    fs/smbfs/proc.c
    fs/fat/misc.c
    fs/udf/udftime.c
    fs/cifs/netmisc.c
    net/netfilter/xt_time.c
    drivers/scsi/ips.c
    drivers/input/misc/hp_sdc_rtc.c
    drivers/rtc/rtc-lib.c
    arch/ia64/hp/sim/boot/fw-emu.c
    arch/m68k/mac/misc.c
    arch/powerpc/kernel/time.c
    arch/parisc/include/asm/rtc.h
    ...
    
    We can make a common function for this type of conversoion, At least we
    can get following benefit:
    
    1: Make kernel simple and unify
    2: Easy to fix bug in converting code
    3: Reduce clone of code in future
       For example, I'm trying to make ftrace display walltime,
       this patch will make me easy.
    
    This code is based on code from glibc-2.6
    Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
    Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Pavel Machek <pavel@ucw.cz>
    Cc: Andi Kleen <andi@firstfloor.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    35c69d10
timeconv.c 3.5 KB