#include #include #include int main() { using namespace std; // int hours, minutes, seconds, hhours, hmin1, hmin2, hseconds, htime; // Variable and Namespace setup int hminutes; // double totalsec, hexsec; time_t epoch_time; // Time is a time_t format struct tm *tm_p; epoch_time = time( NULL ); // tm_p = localtime( &epoch_time ); // Time is extracted from Epoch time hours = tm_p->tm_hour; // minutes = tm_p->tm_min; // Quick variable declaration to keep from using the pointers seconds = tm_p->tm_sec; // totalsec = ( ( ( hours * 60 ) + minutes ) * 60 ) + seconds; // Conversion of time to total seconds hexsec = totalsec / 86400.00 * 65536; // htime = static_cast(hexsec); // hhours = htime / 4096; // Block of mystical mathematics htime = htime - (hhours * 4096); // to properly format the string hminutes = htime / 16; // so it can be displayed hmin1 = hminutes / 16; // hmin2 = hminutes - (hmin1 * 16); // hseconds = htime - (hminutes * 16); // printf("The time in hexadecimal is: %x_%x%x_%x\n", hhours, hmin1, hmin2, hseconds); // Quick print to screen showing the current hexadecimal time return 0; }