Swatch Time





5
Date Submitted Sat. Sep. 8th, 2007 11:41 PM
Revision 1 of 1
Helper eldaniel
Tags CPlusPlus
Comments 0 comments
View swatch time in c++

#include <iostream>
#include <ctime>

using namespace std;

int main(){
    time_t t;
    time(&t);
    struct tm *h = gmtime(&t);

    int seg = h->tm_sec;
    seg += (h->tm_hour * 3600);
    seg += (h->tm_min * 60);

    float c = (seg + 3600) / 86.375; /* + 3600 UTC + 1 */

    cout << "Swatch Time: " << c << endl;

    return 0;
}
 

Daniel Carrasco

daniel.to.md

Comments

There are currently no comments for this snippet.

Voting

Votes Down