Permalink
Browse files

Nothing to see here.

  • Loading branch information...
michaeljgray committed Jan 30, 2012
1 parent a682a7e commit 2f59ad5f664abbda8fd061803d9e700b6c9393ac
Showing with 0 additions and 57 deletions.
  1. +0 −57 time.c
View
57 time.c
@@ -1,57 +0,0 @@
-/*
- * time.c
- * It measures the running time of a process
- * This source code is entered into the public domain because it's silly
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-int main(int count, char* arguments[])
-{
- clock_t start;
- clock_t end;
- double elapsed;
- int exitCode;
-
- if (count <= 1 || count > 2)
- {
- printf("Erroneous arguments specified. Aborting.\n");
- return EXIT_FAILURE;
- }
-
- if (strcmp(arguments[1], "--help") == 0)
- {
- printf("Usage: %s [input]\n", arguments[0]);
- return EXIT_SUCCESS;
- }
-
- start = clock();
- if (start == -1)
- {
- printf("Failed to acquire a starting time reference point. Aborting.\n");
- return EXIT_FAILURE;
- }
-
- exitCode = system(arguments[1]);
- if (exitCode == -1)
- {
- printf("An error was encountered when attempting to start the specified process. Aborting.\n");
- return EXIT_FAILURE;
- }
-
- end = clock();
- if (end == -1)
- {
- printf("Failed to acquire an ending time reference point. Aborting.\n");
- return EXIT_FAILURE;
- }
-
- elapsed = ((double)(end - start)) / CLOCKS_PER_SEC;
-
- printf("%s -> %s in %F second(s) with exit code %d.\n", arguments[0], arguments[1], elapsed, exitCode);
-
- return EXIT_SUCCESS;
-}

0 comments on commit 2f59ad5

Please sign in to comment.