<commit_before>package thx;

using haxe.Int64;
using thx.Ints;
using thx.Int64s;
import thx.DateTimeUtc.*;

@:access(thx.DateTimeUtc)
abstract DateTime(Array<Int64>) {
  static public function localOffset() : Time {
// Date.getTime() in C# is broken hence the special case
#if cs
    var now = cs.system.DateTime.Now;
    return new Time(now.ToUniversalTime().Ticks - now.ToLocalTime().Ticks);
#else
    var now = DateTimeUtc.now(),
        local = new Date(now.year, now.month - 1, now.day, now.hour, now.minute, now.second),
        delta = Math.ffloor(now.toFloat() / 1000) * 1000 - local.getTime();

    return new Time(Int64s.fromFloat(delta) * ticksPerMillisecondI64);
#end
  }

  public var utc(get, never) : DateTimeUtc;
  public var offset(get, never) : Time;

  inline function new(parts : Array<Int64>)
    this = parts;

  @:to inline function get_utc() : DateTimeUtc
    return new DateTimeUtc(this[0]);

  @:to inline function get_offset() : Time
    return new Time(this[1]);

  //1997-07-16T19:20:30+01:00
  public function toString()
    return '$year-${month.lpad(2)}-${day.lpad(2)}T${hour.lpad(2)}:${minute.lpad(2)}:${second.lpad(2)}${millisecond != 0 ? "."+millisecond.lpad(3, "0") : ""}${offset.toGmtString()}';
}<commit_msg>added now and nowUtc for DateTime<commit_after>package thx;

using haxe.Int64;
using thx.Ints;
using thx.Int64s;
import thx.DateTimeUtc.*;

@:access(thx.DateTimeUtc)
abstract DateTime(Array<Int64>) {
  static public function localOffset() : Time {
// Date.getTime() in C# is broken hence the special case
#if cs
    var now = cs.system.DateTime.Now;
    return new Time(now.ToUniversalTime().Ticks - now.ToLocalTime().Ticks);
#else
    var now = DateTimeUtc.now(),
        local = new Date(now.year, now.month - 1, now.day, now.hour, now.minute, now.second),
        delta = Math.ffloor(now.toFloat() / 1000) * 1000 - local.getTime();

    return new Time(Int64s.fromFloat(delta) * ticksPerMillisecondI64);
#end
  }

  inline public static function now() : DateTime
    return create(DateTimeUtc.now(), localOffset());

  inline public static function nowUtc() : DateTime
    return create(DateTimeUtc.now(), Time.zero);

  inline static public function create(dateTime : DateTimeUtc, offset : Time)
    return new DateTime([dateTime.ticks, offset.ticks]);

  public var utc(get, never) : DateTimeUtc;
  public var offset(get, never) : Time;

  inline function new(parts : Array<Int64>)
    this = parts;

  @:to inline function get_utc() : DateTimeUtc
    return new DateTimeUtc(this[0]);

  @:to inline function get_offset() : Time
    return new Time(this[1]);

  //1997-07-16T19:20:30+01:00
  public function toString()
    return '$year-${month.lpad(2)}-${day.lpad(2)}T${hour.lpad(2)}:${minute.lpad(2)}:${second.lpad(2)}${millisecond != 0 ? "."+millisecond.lpad(3, "0") : ""}${offset.toGmtString()}';
}
{'fraction_non_alphanumeric': 0.15842972309849282, 'fraction_numerical': 0.03434980722046968, 'mean_word_length': 4.1516245487364625, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2806225', 'n_tokens_mistral': 1060, 'n_tokens_neox': 989, 'n_words': 237}