Have fixed the segfault by using DateTime instead of SysTime.

That is a separate local variable within this(this). Also, this(this) is the postblit (similar to a copy constructor). Is that what you want to define?

No, but not using this(this) will fail to build with:
static variable _initialized cannot be read at compile time

Making the struct similar to what you suggest will work.
struct prevEv {
  string edate;
  string etime;
  string etext;
  DateTime edatetime;
  this (this)
  {
    edatetime = DateTime(
      Clock.currTime.year,
      to!int(this.edate[2..4]),
      to!int(this.edate[0..2]),
      to!int(etime[0..2]),
      to!int(etime[3..5]),
      to!int(etime[6..8]));
    }
}

Just not has expected, do you have any suggestion how to do it properly?

writeln ( prevEv.edatetime ); //0001-Jan-01 00:00:00
writeln ( prevEv ); // preEv("140212", "05:13:26", "9 140212 05:13:26 d", 2012-Feb-14 05:13:26)



Ali
Thanks

Reply via email to