Re: [PATCH] apply: Recognize epoch timestamps with : in the timezone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

> Hi Anders,
>
> Anders Kaseorg wrote:
>> Some patches have a timezone formatted like '-08:00' instead of
>> '-0800' (e.g. http://lwn.net/Articles/131729/)
>
> Odd.  Any idea what tool generates these patches?
>
>> --- a/builtin/apply.c
>> +++ b/builtin/apply.c
> [...]
>> @@ -765,7 +765,9 @@ static int has_epoch_timestamp(const char *nameline)
>>  	}
>>  
>>  	zoneoffset = strtol(timestamp + m[3].rm_so + 1, NULL, 10);
>> -	zoneoffset = (zoneoffset / 100) * 60 + (zoneoffset % 100);
>> +	if (m[4].rm_so == m[3].rm_so + 3)
>> +		zoneoffset /= 100;
>> +	zoneoffset = zoneoffset * 60 + strtol(timestamp + m[4].rm_so, NULL, 10);
>
> Might be clearer to write
>
> 	if (timestamp[m[3].rm_so + 3] != ':')

Neither the patch nor your suggestion makes much sense to me.  With the
patch, the regexp is now

    ^(1969-12-31|1970-01-01) <time>(\.0+)? ([-+][0-2][0-9]):?([0-5][0-9])

so $3 is always 3 letters long (i.e. hour with sign), no?  IOW, zoneoffset
is never divided by 100 by the original patch.

What am I missing?

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]