ssc-oscar / lookup

A mirror of bitbucket.org/swcs/lookup
1 stars 4 forks source link

c2ta Omits Timezone Adjustment #10

Closed k----n closed 3 years ago

k----n commented 3 years ago

Not sure if this is intended behavior (note the +1100):

> echo "17abdbdc90195016442a6a8dd8e38dea825292ae" | ~/lookup/showCnt commit 2
17abdbdc90195016442a6a8dd8e38dea825292ae;"Albert Krawczyk" <pro-logic@optusnet.com.au>;1292274508 +1100;RE: Git SVN non-standard branch/tag/trunk layout

vs

> echo "17abdbdc90195016442a6a8dd8e38dea825292ae" | ~/lookup/getValues c2ta
17abdbdc90195016442a6a8dd8e38dea825292ae;1292274508;"Albert Krawczyk" <pro-logic@optusnet.com.au>
audrism commented 3 years ago

It does remove the timezone and timezone is actually useful in some cases (detecting ids for the same author). On the other hand, having a clean original unix seconds is also quite helpful as the tz is often messed up.

k----n commented 3 years ago

I wrote a bash script to move the timezone into the unix seconds that modifies the output of ~/lookup/showCnt commit 2, maybe there could be a format that does that?

#!/bin/bash

while IFS= read -r  a; do
    commitID="$( echo "$a" | cut -d\; -f1    )";
    author="$( echo "$a" | cut -d\; -f2  )";
    dateString="$( echo "$a" | cut -d\; -f3 )";
    d0="$( echo "$dateString" | cut -d ' ' -f1 )";
    d1="$( echo "$dateString" | cut -d ' ' -f2 )";
    if [[ "$d1" == *"+"* ]];
        then
            Tz="$(echo $d1 | sed "s/+/-/")"
        else
            Tz="$(echo $d1 | sed "s/-/+/")"
    fi
    noTz=$(date -ud @$d0 +'%a, %d %b %Y %H:%M:%S');
    adjusted=$(date "+%s" -ud "$noTz $Tz");
    echo "$commitID;$adjusted;$dateString;$author"
done
audrism commented 3 years ago

for options 2 and 6 I added tz info after timestamp 6f4384cce903a24193b94cb7f58155b8f83e2e87

It changes functionality, so if it is defined in docs need to change as well