vfs: check userland buffers before reading them.
[haiku.git] / src / apps / haikudepot / server / StandardMetaData.cpp
blob5da9acb7d17c21385973bca530c4d44ba9c83d24
1 /*
2 * Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz>.
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
6 #include "StandardMetaData.h"
8 StandardMetaData::StandardMetaData()
10 fCreateTimestamp = 0;
11 fDataModifiedTimestamp = 0;
15 BDateTime
16 StandardMetaData::_CreateDateTime(uint64_t millisSinceEpoc)
18 time_t secondsSinceEpoc = (millisSinceEpoc / 1000);
19 BDateTime result;
20 result.SetTime_t(secondsSinceEpoc);
21 return result;
25 uint64_t
26 StandardMetaData::GetCreateTimestamp()
28 return fCreateTimestamp;
32 BDateTime
33 StandardMetaData::GetCreateTimestampAsDateTime()
35 return _CreateDateTime(GetCreateTimestamp());
39 void
40 StandardMetaData::SetCreateTimestamp(uint64_t value)
42 fCreateTimestamp = value;
46 uint64_t
47 StandardMetaData::GetDataModifiedTimestamp()
49 return fDataModifiedTimestamp;
53 void
54 StandardMetaData::SetDataModifiedTimestamp(uint64_t value)
56 fDataModifiedTimestamp = value;
60 BDateTime
61 StandardMetaData::GetDataModifiedTimestampAsDateTime()
63 return _CreateDateTime(GetDataModifiedTimestamp());
67 bool
68 StandardMetaData::IsPopulated()
70 return fCreateTimestamp != 0 && fDataModifiedTimestamp != 0;