Changeset 34307


Ignore:
Timestamp:
2012-11-23T21:01:58+01:00 (5 years ago)
Author:
florian
Message:

[package] busybox: change the date -k patch to be more portable

Not all libcs have support for tm_gmtoff which is only available for BSD
compatibility, and guarded with USE_BSD defines, use tm_gmtoff otherwise.

Signed-off-by: Florian Fainelli <florian@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/busybox/patches/911-date-k-flag.patch

    r29203 r34307  
    1 --- a/coreutils/date.c 
    2 +++ b/coreutils/date.c 
     1diff -urN busybox-1.19.4/coreutils/date.c busybox-1.19.4.new/coreutils/date.c 
     2--- busybox-1.19.4/coreutils/date.c     2012-02-04 20:24:55.000000000 +0100 
     3+++ busybox-1.19.4.new/coreutils/date.c 2012-11-23 16:48:21.945200539 +0100 
    34@@ -123,6 +123,7 @@ 
    45 //usage:       IF_FEATURE_DATE_ISOFMT( 
     
    1718 # include <sys/syscall.h> 
    1819 #endif 
    19 @@ -145,8 +147,9 @@ enum { 
     20@@ -145,8 +147,9 @@ 
    2021        OPT_UTC       = (1 << 2), /* u */ 
    2122        OPT_DATE      = (1 << 3), /* d */ 
     
    2930  
    3031 static void maybe_set_utc(int opt) 
    31 @@ -164,12 +167,15 @@ static const char date_longopts[] ALIGN1 
     32@@ -164,12 +167,15 @@ 
    3233        /*      "universal\0" No_argument       "u" */ 
    3334                "date\0"      Required_argument "d" 
     
    4546        struct tm tm_time; 
    4647        char buf_fmt_dt2str[64]; 
    47 @@ -184,7 +190,7 @@ int date_main(int argc UNUSED_PARAM, cha 
     48@@ -184,7 +190,7 @@ 
    4849        opt_complementary = "d--s:s--d" 
    4950                IF_FEATURE_DATE_ISOFMT(":R--I:I--R"); 
     
    5455                        &date_str, &date_str, &filename 
    5556                        IF_FEATURE_DATE_ISOFMT(, &isofmt_arg, &fmt_str2dt)); 
    56 @@ -241,6 +247,27 @@ int date_main(int argc UNUSED_PARAM, cha 
     57@@ -241,6 +247,31 @@ 
    5758        if (*argv) 
    5859                bb_show_usage(); 
     
    6869+ 
    6970+               memset(&tz, 0, sizeof(tz)); 
     71+#ifdef __USE_BSD 
    7072+               tz.tz_minuteswest = -(tm_time.tm_gmtoff / 60); 
     73+#else 
     74+               tz.tz_minuteswest = -(tm_time.__tm_gmtoff / 60); 
     75+#endif 
    7176+ 
    7277+               if (settimeofday(NULL, &tz)) 
Note: See TracChangeset for help on using the changeset viewer.