blob: faa212e78fd7446e9db2240887025b217092478b (
plain) (
blame)
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
|
//+-------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1992 - 1992.
//
// File: Time16.CXX
//
// Contents: Time conversion routines (16-bit only)
//
// Functions: DfGetTOD
//
// History: 13-Nov-92 AlexT Created
//
// Notes: These functions come from NT - time.c
//
//--------------------------------------------------------------------------
#include <exphead.cxx>
#pragma hdrstop
#include <time16.hxx>
#include <dos.h>
#ifdef CODESEGMENTS
#pragma code_seg(SEG_DfGetTOD)
#endif
SCODE DfGetTOD(TIME_T *pft)
{
#ifndef REF
SCODE sc;
WORD packedtime, packeddate;
struct _dosdate_t dosdate;
struct _dostime_t dostime;
_dos_gettime(&dostime);
packedtime = (dostime.second/2) | (dostime.minute<<5) | (dostime.hour<<11);
_dos_getdate(&dosdate);
packeddate = dosdate.day | (dosdate.month<<5) | ((dosdate.year-1980)<<9);
BOOL b = CoDosDateTimeToFileTime(packeddate, packedtime, pft);
if (b)
{
sc = S_OK;
}
else
{
olAssert(!aMsg("Unable to convert time"));
sc = E_UNEXPECTED;
}
return(sc);
#else
//REFBUG: A time of day function needs to be provided for any port of this
// code.
return S_OK;
#endif //!REF
}
|