Newer
Older
tuved / src / server.c
@Charlie Root Charlie Root on 15 Apr 2019 1 KB Sync
#include <stdio.h>

#include "tuved.h"


int tuveStatus(myConnections_t *userConnection) {
  char output[512];
  int day,hour,min,sec;
  time_t curTime;

  curTime = time(NULL);


  sprintf(output,"MSG:TUveD:STATUS:Server on-line since: %s",ctime(&startTime));
  sSendData(userConnection,output);
  curTime -= startTime;
  day = curTime / 86400; 
  curTime -= (86400 * day);
  hour = curTime / 3600;
  curTime -= (3600 * hour);
  min = curTime / 60;
  curTime -= (60 * min);
  sec = curTime;
  sprintf(output,"MSG:TUveD:STATUS:Server is running TUveD %s",VERSION);
  sSendData(userConnection,output);
  sprintf(output,"MSG:TUveD:STATUS:Server has been running for %i days %i hours %i min %.2i sec",day,hour,min,sec);
  sSendData(userConnection,output);
  sprintf(output,"MSG:TUveD:STATUS:There are currently %i users online.",userCount);
  sSendData(userConnection,output);
  sprintf(output,"MSG:TUveD:STATUS:There are currently %i channels active.",channelCount);
  sSendData(userConnection,output);
  curTime = playCount;
  day = curTime / 86400; 
  curTime -= (86400 * day);
  hour = curTime / 3600;
  curTime -= (3600 * hour);
  min = curTime / 60;
  curTime -= (60 * min);
  sec = curTime;
  sprintf(output,"MSG:TUveD:STATUS:There have been %i videos played. For a total Playtime of %i days %i hours %i min %.2i secs",songCount,day,hour,min,sec);
  sSendData(userConnection,output);

  return(0x0);
} // tuveStatus()