viewing paste Unknown #18107 | C++

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#include <iostream>    
#include <time.h>
#include "struct.h"
 
using namespace std;
 
 
int ReturnTime(int &hours,int &minuets, int &seconds)
{
 
    
        const int SECONDS_IN_MINUTE = 60;
        const int SECONDS_IN_HOUR = 60 * SECONDS_IN_MINUTE;
        //hours = (hours + 24) % 24 uglier method instead of Time zone offset
        const int SECONDS_IN_DAY = 24 * SECONDS_IN_HOUR;
        const int TIME_ZONE_OFFSET = -4 * SECONDS_IN_HOUR;
 
        time_t time_t = time(NULL) + TIME_ZONE_OFFSET;
 
 
        hours = time_t % SECONDS_IN_DAY / SECONDS_IN_HOUR;
        minuets = time_t % SECONDS_IN_HOUR / SECONDS_IN_MINUTE;
        seconds = time_t % SECONDS_IN_MINUTE / 1;
    
        //printf("%d:%d:%d 00:00\n", hours, minutes, seconds);
        
        cout << hours << ": " << minuets  << ": " << seconds << "\n";
 
    
 
    return 0;
}
 
int CheckTime(struct time* currentTime)
{
    
    cout << currentTime->HOUR << "\n";
    cout << currentTime->HOUR + 1 << "\n"; 
 
 
    return 0;
}
 
Viewed 647 times, submitted by Guest.