Development > PC, Mac & Vintage Computers

Useless s*** i wrote

(1/1)

gameblabla:
Post here your crappy code that either useless or very poor in quality.
Here's one, that calculates the time that takes for that mom to gain 70000000 kilos in milliseconds.


--- Code: ---#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <time.h>

int main(void)
{
    double yourmom = 0.0;
    double timetohold[2];
    double final_result = 0.0;
    struct timespec ts;
   
    timespec_get(&ts, TIME_UTC);
    timetohold[0] = ts.tv_nsec;
   
    while (yourmom < 70000000)
    {
    yourmom += 1.0;
    }

    timespec_get(&ts, TIME_UTC);
    timetohold[1] = ts.tv_nsec;
    final_result = timetohold[1] - timetohold[0];
    printf("Your mom gained 70000000 kilos in %f milliseconds\n", final_result / 1000000);
    return 0;
}
--- End code ---

Navigation

[0] Message Index

Go to full version