Exemplo n.º 1
0
from time import time
from botcoin import database, User, Item, commands
from random import random
import math

cursorExecute = database.cursorExecute

database.init()
User.init(cursorExecute)
Item.init(cursorExecute)


def secondsToTime( seconds ):
	result = ""
	atLeastOneMinute = False
	arLeastOneHour = False
	if math.floor(seconds / 3600)>0:
		arLeastOneHour = True
		result += str(math.floor(seconds / 3600)) + " hour"
		if math.floor(seconds / 3600)>=2: result += "s"
		seconds = math.floor(seconds % 3600)
	if math.floor(seconds / 60)>0:
		atLeastOneMinute = True
		if arLeastOneHour:
			result += ", "
		result += str(math.floor(seconds / 60)) + " minute"
		if math.floor(seconds / 60)>=2: result += "s"
		seconds = math.floor(seconds % 60)
	if atLeastOneMinute:
		result += " and "
	result += str(seconds) + " second"