#include #include /* uptime.exe v0.1 outputs uptime (in seconds) to a file, in a format that cURL can use to POST. (a calling batch file will add the other variables) ;o) */ int main(int argc) { FILE * utInfo; long sec; sec = 0; if (argc > 1) { printf("\n outputs the time since the peecee booted\n"); printf(" to a file, in curl POST format\n\n"); printf(" usage: uptime\n\n"); printf(" no additional arguments required!\n"); printf(" v0.1-amip (c) corz.org 2005 ->\n\n"); return 1; } // get number of milliseconds PC has been up.. sec = GetTickCount() / 1000; // and convert into seconds // lastly, output uptime to file.. utInfo = fopen ("uptime.nfo","wb"); if (utInfo != NULL) { fprintf(utInfo, "-d \"uptime=%d\"\n", sec); fclose (utInfo); return 0; } else { // oh oh! fprintf(stderr, "couldn't open the file for writing"); return 1; } }