]> granicus.if.org Git - php/commitdiff
Merge whitespace changes that have been made to timelib and PHP-5.6 and master
authorDerick Rethans <github@derickrethans.nl>
Tue, 28 Apr 2015 14:57:26 +0000 (15:57 +0100)
committerDerick Rethans <github@derickrethans.nl>
Tue, 28 Apr 2015 14:57:26 +0000 (15:57 +0100)
ext/date/lib/astro.c
ext/date/lib/dow.c
ext/date/lib/parse_date.re
ext/date/lib/parse_iso_intervals.re
ext/date/lib/parse_tz.c
ext/date/lib/timelib.c
ext/date/lib/timelib.h
ext/date/lib/tm2unixtime.c
ext/date/lib/unixtime2tm.c

index 2be98d7e3abf484294f0f5427d6dbea0727a2399..02b1783250affce2a28caed81daff748f1e01893 100644 (file)
@@ -115,7 +115,7 @@ static double astro_GMST0(double d)
        /* time, imposing no runtime or code overhead.               */
        sidtim0 = astro_revolution((180.0 + 356.0470 + 282.9404) + (0.9856002585 + 4.70935E-5) * d);
        return sidtim0;
-} 
+}
 
 /* This function computes the Sun's position at any instant */
 
@@ -177,32 +177,32 @@ static void astro_sun_RA_dec(double d, double *RA, double *dec, double *r)
 
 /**
  * Note: timestamp = unixtimestamp (NEEDS to be 00:00:00 UT)
- *       Eastern longitude positive, Western longitude negative       
- *       Northern latitude positive, Southern latitude negative       
- *       The longitude value IS critical in this function!            
- *       altit = the altitude which the Sun should cross              
- *               Set to -35/60 degrees for rise/set, -6 degrees       
- *               for civil, -12 degrees for nautical and -18          
- *               degrees for astronomical twilight.                   
- *         upper_limb: non-zero -> upper limb, zero -> center         
- *               Set to non-zero (e.g. 1) when computing rise/set     
- *               times, and to zero when computing start/end of       
- *               twilight.                                            
- *        *rise = where to store the rise time                        
- *        *set  = where to store the set  time                        
- *                Both times are relative to the specified altitude,  
- *                and thus this function can be used to compute       
- *                various twilight times, as well as rise/set times   
- * Return value:  0 = sun rises/sets this day, times stored at        
- *                    *trise and *tset.                               
- *               +1 = sun above the specified "horizon" 24 hours.     
- *                    *trise set to time when the sun is at south,    
- *                    minus 12 hours while *tset is set to the south  
- *                    time plus 12 hours. "Day" length = 24 hours     
- *               -1 = sun is below the specified "horizon" 24 hours   
- *                    "Day" length = 0 hours, *trise and *tset are    
- *                    both set to the time when the sun is at south.  
- *                                                                    
+ *       Eastern longitude positive, Western longitude negative
+ *       Northern latitude positive, Southern latitude negative
+ *       The longitude value IS critical in this function!
+ *       altit = the altitude which the Sun should cross
+ *               Set to -35/60 degrees for rise/set, -6 degrees
+ *               for civil, -12 degrees for nautical and -18
+ *               degrees for astronomical twilight.
+ *         upper_limb: non-zero -> upper limb, zero -> center
+ *               Set to non-zero (e.g. 1) when computing rise/set
+ *               times, and to zero when computing start/end of
+ *               twilight.
+ *        *rise = where to store the rise time
+ *        *set  = where to store the set  time
+ *                Both times are relative to the specified altitude,
+ *                and thus this function can be used to compute
+ *                various twilight times, as well as rise/set times
+ * Return value:  0 = sun rises/sets this day, times stored at
+ *                    *trise and *tset.
+ *               +1 = sun above the specified "horizon" 24 hours.
+ *                    *trise set to time when the sun is at south,
+ *                    minus 12 hours while *tset is set to the south
+ *                    time plus 12 hours. "Day" length = 24 hours
+ *               -1 = sun is below the specified "horizon" 24 hours
+ *                    "Day" length = 0 hours, *trise and *tset are
+ *                    both set to the time when the sun is at south.
+ *
  */
 int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat, double altit, int upper_limb, double *h_rise, double *h_set, timelib_sll *ts_rise, timelib_sll *ts_set, timelib_sll *ts_transit)
 {
index b8d64b62313864373dc4f2b0b064522c2ad3219b..e34d67d21c52563a9e54c68ff09ad7679c4665bc 100644 (file)
@@ -136,7 +136,7 @@ void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, time
 timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d)
 {
        timelib_sll dow, day;
-       
+
        /* Figure out the dayofweek for y-1-1 */
        dow = timelib_day_of_week(y, 1, 1);
        /* then use that to figure out the offset for day 1 of week 1 */
index 66d4f223889a653f5119e69e8e23d0821f42efd4..32910072a7cf1dac4a7ed2f694b7e91e3b8d37e7 100644 (file)
@@ -677,7 +677,7 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
        if (strcasecmp("utc", word) == 0 || strcasecmp("gmt", word) == 0) {
                return timelib_timezone_utc;
        }
-       
+
        for (tp = timelib_timezone_lookup; tp->name; tp++) {
                if (strcasecmp(word, tp->name) == 0) {
                        if (!first_found) {
@@ -808,7 +808,7 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
 {
        uchar *cursor = s->cur;
        char *str, *ptr = NULL;
-               
+
 std:
        s->tok = cursor;
        s->len = 0;
@@ -1437,7 +1437,7 @@ weekdayof        = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
                TIMELIB_INIT;
                TIMELIB_HAVE_DATE();
                TIMELIB_HAVE_RELATIVE();
-               
+
                s->time->y = timelib_get_nr((char **) &ptr, 4);
                w = timelib_get_nr((char **) &ptr, 2);
                d = timelib_get_nr((char **) &ptr, 1);
@@ -1456,7 +1456,7 @@ weekdayof        = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
                TIMELIB_INIT;
                TIMELIB_HAVE_DATE();
                TIMELIB_HAVE_RELATIVE();
-               
+
                s->time->y = timelib_get_nr((char **) &ptr, 4);
                w = timelib_get_nr((char **) &ptr, 2);
                d = 1;
@@ -1560,7 +1560,7 @@ weekdayof        = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
                if (s->time->relative.weekday_behavior != 2) {
                        s->time->relative.weekday_behavior = 1;
                }
-               
+
                TIMELIB_DEINIT;
                return TIMELIB_WEEKDAY;
        }
@@ -1877,7 +1877,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
                                                add_pbf_error(s, "A textual day could not be found", string, begin);
                                                break;
                                        } else {
-                                               in.time->have_relative = 1; 
+                                               in.time->have_relative = 1;
                                                in.time->relative.have_weekday_relative = 1;
                                                in.time->relative.weekday = tmprel->multiplier;
                                                in.time->relative.weekday_behavior = 1;
@@ -2148,13 +2148,13 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
 
        /* do funky checking whether the parsed time was valid time */
        if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
-               s->time->s != TIMELIB_UNSET && 
+               s->time->s != TIMELIB_UNSET &&
                !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
                add_pbf_warning(s, "The parsed time was invalid", string, ptr);
        }
        /* do funky checking whether the parsed date was valid date */
        if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
-               s->time->d != TIMELIB_UNSET && 
+               s->time->d != TIMELIB_UNSET &&
                !timelib_valid_date( s->time->y, s->time->m, s->time->d)) {
                add_pbf_warning(s, "The parsed date was invalid", string, ptr);
        }
@@ -2227,7 +2227,7 @@ int main(void)
        printf ("%04d-%02d-%02d %02d:%02d:%02d.%-5d %+04d %1d",
                time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
        if (time.have_relative) {
-               printf ("%3dY %3dM %3dD / %3dH %3dM %3dS", 
+               printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
                        time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative.s);
        }
        if (time.have_weekday_relative) {
@@ -2236,7 +2236,7 @@ int main(void)
        if (time.have_weeknr_day) {
                printf(" / %dW%d", time.relative.weeknr_day.weeknr, time.relative.weeknr_day.dayofweek);
        }
-       return 0;                               
+       return 0;
 }
 #endif
 
index aa69e2060f307979364e54c8b70f155b1de414f7..1c5e3234469255f0beb7c456dc65b80015bc6336 100644 (file)
@@ -242,7 +242,7 @@ static int scan(Scanner *s)
 {
        uchar *cursor = s->cur;
        char *str, *ptr = NULL;
-               
+
 std:
        s->tok = cursor;
        s->len = 0;
@@ -336,11 +336,11 @@ isoweek          = year4 "-"? "W" weekofyear;
                                case 'D': s->period->d = nr; break;
                                case 'H': s->period->h = nr; break;
                                case 'S': s->period->s = nr; break;
-                               case 'M': 
+                               case 'M':
                                        if (in_time) {
                                                s->period->i = nr;
                                        } else {
-                                               s->period->m = nr; 
+                                               s->period->m = nr;
                                        }
                                        break;
                                default:
@@ -398,9 +398,9 @@ isoweek          = year4 "-"? "W" weekofyear;
 
 /*!max:re2c */
 
-void timelib_strtointerval(char *s, int len, 
-                           timelib_time **begin, timelib_time **end, 
-                                                  timelib_rel_time **period, int *recurrences, 
+void timelib_strtointerval(char *s, int len,
+                           timelib_time **begin, timelib_time **end,
+                                                  timelib_rel_time **period, int *recurrences,
                                                   struct timelib_error_container **errors)
 {
        Scanner in;
index 89b8af73d6c3b288b7236eb2d94e217a2600a313..db29495a85aa5f39f21926d9fbbb6ed1a264f8b9 100644 (file)
@@ -36,7 +36,7 @@
 #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
 # if defined(__LITTLE_ENDIAN__)
 #  undef WORDS_BIGENDIAN
-# else 
+# else
 #  if defined(__BIG_ENDIAN__)
 #   define WORDS_BIGENDIAN
 #  endif
@@ -56,7 +56,7 @@ static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
        /* read ID */
        version = (*tzf)[3] - '0';
        *tzf += 4;
-       
+
        /* read BC flag */
        tz->bc = (**tzf == '\1');
        *tzf += 1;
@@ -119,7 +119,7 @@ static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
                memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->timecnt);
                *tzf += sizeof(unsigned char) * tz->timecnt;
        }
-       
+
        tz->trans = buffer;
        tz->trans_idx = cbuffer;
 }
@@ -307,7 +307,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
                cur_locale = strdup(tmp);
        }
        setlocale(LC_CTYPE, "C");
-#endif 
+#endif
 
        do {
                int mid = ((unsigned)left + right) >> 1;
@@ -322,7 +322,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
 #ifdef HAVE_SETLOCALE
                        setlocale(LC_CTYPE, cur_locale);
                        if (cur_locale) free(cur_locale);
-#endif 
+#endif
                        return 1;
                }
 
@@ -331,7 +331,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
 #ifdef HAVE_SETLOCALE
        setlocale(LC_CTYPE, cur_locale);
        if (cur_locale) free(cur_locale);
-#endif 
+#endif
        return 0;
 }
 
@@ -449,7 +449,7 @@ int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz)
 {
        ttinfo *to;
        timelib_sll dummy;
-       
+
        if ((to = fetch_timezone_offset(tz, ts, &dummy))) {
                return to->isdst;
        }
@@ -492,12 +492,12 @@ timelib_sll timelib_get_current_offset(timelib_time *t)
 {
        timelib_time_offset *gmt_offset;
        timelib_sll retval;
-                       
+
        switch (t->zone_type) {
                case TIMELIB_ZONETYPE_ABBR:
                case TIMELIB_ZONETYPE_OFFSET:
                        return (t->z + t->dst) * -60;
-                       
+
                case TIMELIB_ZONETYPE_ID:
                        gmt_offset = timelib_get_time_zone_info(t->sse, t->tz_info);
                        retval = gmt_offset->offset;
index 47ddfa7d87eba70f5ec06341a8236c5814509f99..b2da6f86c93ed6c29c236bfec0346e66fbb8c03d 100644 (file)
@@ -122,7 +122,7 @@ timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
        tmp->timecnt = tz->timecnt;
        tmp->typecnt = tz->typecnt;
        tmp->charcnt = tz->charcnt;
-       
+
        tmp->trans = (int32_t *) malloc(tz->timecnt * sizeof(int32_t));
        tmp->trans_idx = (unsigned char*) malloc(tz->timecnt * sizeof(unsigned char));
        memcpy(tmp->trans, tz->trans, tz->timecnt * sizeof(int32_t));
@@ -236,7 +236,7 @@ void timelib_dump_date(timelib_time *d, int options)
 
        if ((options & 1) == 1) {
                if (d->have_relative) {
-                       printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS", 
+                       printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS",
                                d->relative.y, d->relative.m, d->relative.d, d->relative.h, d->relative.i, d->relative.s);
                        if (d->relative.first_last_day_of != 0) {
                                switch (d->relative.first_last_day_of) {
@@ -271,7 +271,7 @@ void timelib_dump_date(timelib_time *d, int options)
 
 void timelib_dump_rel_time(timelib_rel_time *d)
 {
-       printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS (days: %lld)%s", 
+       printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS (days: %lld)%s",
                d->y, d->m, d->d, d->h, d->i, d->s, d->days, d->invert ? " inverted" : "");
        if (d->first_last_day_of != 0) {
                switch (d->first_last_day_of) {
index 28f3b8c924cc9503956b360bba847c63f4f91e0e..cf9acdc233ec41451918b0937efe9baa1e571219 100644 (file)
@@ -80,8 +80,8 @@ long timelib_parse_tz_cor(char**);
 
 /* From parse_iso_intervals.re */
 void timelib_strtointerval(char *s, int len, 
-                           timelib_time **begin, timelib_time **end, 
-                                                  timelib_rel_time **period, int *recurrences, 
+                           timelib_time **begin, timelib_time **end,
+                                                  timelib_rel_time **period, int *recurrences,
                                                   struct timelib_error_container **errors);
 
 
index 0f59d31516b02b09b6467ee6a8ef6ed60c313bb9..5addf67748bb5c22aed3cb99e6a7c34f91f968b8 100644 (file)
@@ -106,7 +106,7 @@ static int do_range_limit_days(timelib_sll *y, timelib_sll *m, timelib_sll *d)
        timelib_sll days_this_month;
        timelib_sll last_month, last_year;
        timelib_sll days_last_month;
-       
+
        /* can jump an entire leap year period quickly */
        if (*d >= DAYS_PER_LYEAR_PERIOD || *d <= -DAYS_PER_LYEAR_PERIOD) {
                *y += YEARS_PER_LYEAR_PERIOD * (*d / DAYS_PER_LYEAR_PERIOD);
@@ -396,7 +396,7 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
                                timelib_time_offset *before, *after;
                                timelib_sll          tmp;
                                int                  in_transistion;
-                               
+
                                tz->is_localtime = 1;
                                before = timelib_get_time_zone_info(tz->sse, tzi);
                                after = timelib_get_time_zone_info(tz->sse - before->offset, tzi);
@@ -406,7 +406,7 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
                                        ((tz->sse - after->offset) >= (after->transistion_time + (before->offset - after->offset))) &&
                                        ((tz->sse - after->offset) < after->transistion_time)
                                );
-                               
+
                                if ((before->offset != after->offset) && !in_transistion) {
                                        tmp = -after->offset;
                                } else {
@@ -464,7 +464,7 @@ int main(void)
        printf ("%04d-%02d-%02d %02d:%02d:%02d.%-5d %+04d %1d",
                time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
        if (time.have_relative) {
-               printf ("%3dY %3dM %3dD / %3dH %3dM %3dS", 
+               printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
                        time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative.s);
        }
        if (time.have_weekday_relative) {
index 3c400800fd0a77fe625590cb9a4aa16f9c508909..f23f958c70ba100721c75a468f891a91ccf45962 100644 (file)
@@ -141,7 +141,7 @@ void timelib_update_from_sse(timelib_time *tm)
        signed int dst = tm->dst;
 
        sse = tm->sse;
-       
+
        switch (tm->zone_type) {
                case TIMELIB_ZONETYPE_ABBR:
                case TIMELIB_ZONETYPE_OFFSET: {
@@ -152,11 +152,11 @@ void timelib_update_from_sse(timelib_time *tm)
 
                case TIMELIB_ZONETYPE_ID: {
                        timelib_time_offset *gmt_offset;
-                       
+
                        gmt_offset = timelib_get_time_zone_info(tm->sse, tm->tz_info);
                        timelib_unixtime2gmt(tm, tm->sse + gmt_offset->offset);
                        timelib_time_offset_dtor(gmt_offset);
-                       
+
                        goto cleanup;
                }
 
@@ -182,7 +182,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
                case TIMELIB_ZONETYPE_OFFSET: {
                        int z = tm->z;
                        signed int dst = tm->dst;
-                       
+
                        timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600));
 
                        tm->z = z;
@@ -195,7 +195,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
                        timelib_unixtime2gmt(tm, ts + gmt_offset->offset);
 
                        /* we need to reset the sse here as unixtime2gmt modifies it */
-                       tm->sse = ts; 
+                       tm->sse = ts;
                        tm->dst = gmt_offset->is_dst;
                        tm->z = gmt_offset->offset;
                        tm->tz_info = tz;