Style fixes

This commit is contained in:
Vasily Nemkov 2019-10-09 23:01:52 +03:00
parent c1f9fcc3d5
commit 7afff3d661
5 changed files with 8 additions and 54 deletions

View File

@ -1,22 +0,0 @@
#include <Core/DateTime64.h>
#include <cassert>
namespace DB {
//static constexpr UInt32 NANOS_PER_SECOND = 1000 * 1000 * 1000;
//DateTime64::Components DateTime64::split() const
//{
// auto datetime = static_cast<time_t>(t / NANOS_PER_SECOND);
// auto nanos = static_cast<UInt32>(t % NANOS_PER_SECOND);
// return Components { datetime, nanos };
//}
//DateTime64::DateTime64(DateTime64::Components c)
// : t {c.datetime * NANOS_PER_SECOND + c.nanos}
//{
// assert(c.nanos < NANOS_PER_SECOND);
//}
}

View File

@ -1,28 +0,0 @@
#pragma once
#include <Core/Types.h>
namespace DB {
//// this is a separate struct to avoid accidental conversions that
//// might occur between time_t and the type storing the datetime64
//// time_t might have a different definition on different libcs
//struct DateTime64 {
// using Type = Int64;
// struct Components {
// time_t datetime = 0;
// UInt32 nanos = 0;
// };
// Components split() const;
// explicit DateTime64(Components c);
// explicit DateTime64(Type tt) : t{tt} {}
// explicit operator bool() const {
// return t != 0;
// }
// Type get() const { return t; }
//private:
// Type t;
//};
}

View File

@ -48,7 +48,8 @@ protected:
* Server time zone is the time zone specified in 'timezone' parameter in configuration file, * Server time zone is the time zone specified in 'timezone' parameter in configuration file,
* or system time zone at the moment of server startup. * or system time zone at the moment of server startup.
*/ */
class DataTypeDateTime final : public DataTypeNumberBase<UInt32>, public TimezoneMixin { class DataTypeDateTime final : public DataTypeNumberBase<UInt32>, public TimezoneMixin
{
public: public:
explicit DataTypeDateTime(const std::string & time_zone_name = ""); explicit DataTypeDateTime(const std::string & time_zone_name = "");
@ -79,7 +80,8 @@ public:
* *
* `scale` determines number of decimal places for sub-second part of the DateTime64. * `scale` determines number of decimal places for sub-second part of the DateTime64.
*/ */
class DataTypeDateTime64 final : public DataTypeDecimalBase<DateTime64>, public TimezoneMixin { class DataTypeDateTime64 final : public DataTypeDecimalBase<DateTime64>, public TimezoneMixin
{
public: public:
static constexpr UInt8 default_scale = 3; static constexpr UInt8 default_scale = 3;

View File

@ -16,7 +16,8 @@ namespace ErrorCodes
} }
template<class Transform> template<class Transform>
struct WithDateTime64Converter : public Transform { struct WithDateTime64Converter : public Transform
{
UInt8 scale; UInt8 scale;
Transform transform; Transform transform;

View File

@ -16,7 +16,8 @@ namespace ErrorCodes
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
} }
DateTime64::NativeType nowSubsecond(UInt32 scale) { DateTime64::NativeType nowSubsecond(UInt32 scale)
{
timespec spec; timespec spec;
clock_gettime(CLOCK_REALTIME, &spec); clock_gettime(CLOCK_REALTIME, &spec);