| 1 | // Licensed to the .NET Foundation under one or more agreements. |
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | |
| 5 | /*============================================================================ |
| 6 | ** |
| 7 | ** Source: test1.c |
| 8 | ** |
| 9 | ** Purpose: Calls the time function and verifies that the time returned |
| 10 | ** is at least a positive value. |
| 11 | ** |
| 12 | ** |
| 13 | **==========================================================================*/ |
| 14 | |
| 15 | #include <palsuite.h> |
| 16 | |
| 17 | int __cdecl main(int argc, char **argv) |
| 18 | { |
| 19 | time_t t = 0; |
| 20 | |
| 21 | if (PAL_Initialize(argc, argv)) |
| 22 | { |
| 23 | return FAIL; |
| 24 | } |
| 25 | |
| 26 | |
| 27 | time(&t); |
| 28 | /*I was going to test that the time returned didn't exceed some |
| 29 | reasonable value, but decided not to, for fear of creating my own |
| 30 | little Y2K-style disaster.*/ |
| 31 | |
| 32 | if (t <= 0) |
| 33 | { |
| 34 | Fail("time() function doesn't return a time.\n" ); |
| 35 | } |
| 36 | t = 0; |
| 37 | t = time(NULL); |
| 38 | if (t <= 0) |
| 39 | { |
| 40 | Fail("time() function doesn't return a time.\n" ); |
| 41 | } |
| 42 | PAL_Terminate(); |
| 43 | return PASS; |
| 44 | } |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |