TV-based reconstruction of periodic functions