blob: 28d869f444b076a5bec0c20efbe3d2280149385b (
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
|
/*
* Copyright (c) 2022, Undefine <undefine@undefine.pl>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DOSPackedTime.h>
namespace AK {
Time time_from_packed_dos(DOSPackedDate date, DOSPackedTime time)
{
if (date.value == 0)
return Time();
return Time::from_timestamp(first_dos_year + date.year, date.month, date.day, time.hour, time.minute, time.second * 2, 0);
}
DOSPackedDate to_packed_dos_date(unsigned year, unsigned month, unsigned day)
{
DOSPackedDate date;
date.year = year - first_dos_year;
date.month = month;
date.day = day;
return date;
}
DOSPackedTime to_packed_dos_time(unsigned hour, unsigned minute, unsigned second)
{
DOSPackedTime time;
time.hour = hour;
time.minute = minute;
time.second = second / 2;
return time;
}
}
|