summaryrefslogtreecommitdiff
path: root/support/dktools/dk4ftime.c
blob: 84c0793520bf33272945cf7445ce26a8f88e26ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
Copyright (C) 2015-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/

/*
	WARNING: This file was generated by the dkct program (see
	http://dktools.sourceforge.net/ for details).
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: dk4ftime.ctr
*/

/**	@file dk4ftime.c The dk4ftime module.
*/


#line 207 "dk4ftime.ctr"

#include "dk4conf.h"
#include "dk4ftime.h"

#if !DK4_ON_WINDOWS
#include "dk4timedk.h"
#endif

int
dk4filetime_compare(const dk4_file_time_t *l, const dk4_file_time_t *r)
{
  int		 back = 0;
  if (NULL != l) {
    if (NULL != r) {
#if DK4_ON_WINDOWS
      if (l->dwHighDateTime > r->dwHighDateTime) {
        back = 1;
      } else {
        if (l->dwHighDateTime < r->dwHighDateTime) {
	  back = -1;
	} else {
	  if (l->dwLowDateTime > r->dwLowDateTime) {
	    back = 1;
	  } else {
	    if (l->dwLowDateTime < r->dwLowDateTime) {
	      back = -1;
	    }
	  }
	}
      }
#else
      if (*l > *r) {
        back = 1;
      } else {
        if (*l < *r) {
	  back = -1;
	}
      }
#endif
    } else {
      back = 1;
    }
  } else {
    if (NULL != r) {
      back = -1;
    }
  }
  return back;
}