|
31 | 31 | #include "win32/time.h" |
32 | 32 | #endif |
33 | 33 |
|
34 | | -#ifdef PHP_WIN32 |
35 | | -static __inline __int64 php_date_llabs( __int64 i ) { return i >= 0? i: -i; } |
36 | | -#elif defined(__GNUC__) && __GNUC__ < 3 |
37 | | -static __inline __int64_t php_date_llabs( __int64_t i ) { return i >= 0 ? i : -i; } |
38 | | -#else |
39 | | -static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i; } |
40 | | -#endif |
| 34 | +static inline uint64_t php_date_llabs(int64_t i) { return i >= 0 ? (uint64_t)i : -(uint64_t)i; } |
41 | 35 |
|
42 | 36 | #ifdef PHP_WIN32 |
43 | 37 | #define DATE_I64_BUF_LEN 65 |
@@ -742,9 +736,9 @@ static zend_string *date_format(const char *format, size_t format_len, const tim |
742 | 736 | /* year */ |
743 | 737 | case 'L': length = slprintf(buffer, sizeof(buffer), "%d", timelib_is_leap((int) t->y)); break; |
744 | 738 | case 'y': length = slprintf(buffer, sizeof(buffer), "%02d", (int) (t->y % 100)); break; |
745 | | - case 'Y': length = slprintf(buffer, sizeof(buffer), "%s%04lld", t->y < 0 ? "-" : "", php_date_llabs((timelib_sll) t->y)); break; |
746 | | - case 'x': length = slprintf(buffer, sizeof(buffer), "%s%04lld", t->y < 0 ? "-" : (t->y >= 10000 ? "+" : ""), php_date_llabs((timelib_sll) t->y)); break; |
747 | | - case 'X': length = slprintf(buffer, sizeof(buffer), "%s%04lld", t->y < 0 ? "-" : "+", php_date_llabs((timelib_sll) t->y)); break; |
| 739 | + case 'Y': length = slprintf(buffer, sizeof(buffer), "%s%04" PRIu64, t->y < 0 ? "-" : "", php_date_llabs((timelib_sll) t->y)); break; |
| 740 | + case 'x': length = slprintf(buffer, sizeof(buffer), "%s%04" PRIu64, t->y < 0 ? "-" : (t->y >= 10000 ? "+" : ""), php_date_llabs((timelib_sll) t->y)); break; |
| 741 | + case 'X': length = slprintf(buffer, sizeof(buffer), "%s%04" PRIu64, t->y < 0 ? "-" : "+", php_date_llabs((timelib_sll) t->y)); break; |
748 | 742 |
|
749 | 743 | /* time */ |
750 | 744 | case 'a': length = slprintf(buffer, sizeof(buffer), "%s", t->h >= 12 ? "pm" : "am"); break; |
|
0 commit comments