debuuug and change to get time from mysql instead of systime