Date to second since 1970

Hello,
I have found a piece of code which converts seconds elapsed since 1970 for an input date. Can anyone please explain a little bit the code below:

#!/bin/bash
# function to reproduce UNIX time() value
second()
{
set -- $(TZ=GMT date '+%Y %m %d')
local y=$1 m=1$2 d=1$3
((m-=103, d-=101, m<0 && (m+=12, --y)))
((d+=(m*153 + 2)/5+y*365+y/4-y/100+y/400-719468))
echo $((d*86400))
}