diff --git a/channel.c b/channel.c index 076d6de..f4a9d1d 100644 --- a/channel.c +++ b/channel.c @@ -279,7 +279,7 @@ int deltaTime, day, hour, min, sec; char output[1024]; char nick[MAX_USER_LEN + 1]; - //mji char topicTime[1024]; + char topicTime[128]; tmpChannel = findChan(channel); @@ -347,16 +347,26 @@ sSendData(userConnection,output); sprintf(output,"MSG:TUveD:%s:Topic for %s: %s\n",tmpChannel->channel,tmpChannel->channel,tmpChannel->topic); sSendData(userConnection,output); + deltaTime = time(NULL) - tmpChannel->topicSet; - day = deltaTime / 86400; - deltaTime -= (86400 * day); + day = deltaTime / (3600*24); + deltaTime -= ((3600*24) * day); hour = deltaTime / 3600; deltaTime -= (3600 * hour); min = deltaTime / 60; deltaTime -= (60 * min); sec = deltaTime; - sprintf(output,"MSG:TUveD:%s:Topic was set by %s %i seconds ago.\n",tmpChannel->channel,tmpChannel->topicSetBy,time(NULL) - tmpChannel->topicSet); + if (day) + sprintf(topicTime, "%i:%i:%i:%i", day, hour, min, sec); + else + if (hour) sprintf(topicTime, "%i:%i:%i", hour, min, sec); + else + if (min) sprintf(topicTime, "%i:%i", min, sec); + else + sprintf(topicTime, "%i", sec); + + sprintf(output,"MSG:TUveD:%s:Topic was set by %s %s seconds ago.\n",tmpChannel->channel,tmpChannel->topicSetBy, topicTime); sSendData(userConnection,output); if (tmpChannel->modes[CHAN_TIME] == 1) {