Major issues in givetime.py

In some cases str wasn't converted to int which leads to completely wrong result.