SysTime in a Struct
albatroz
rmcjustino at gmail.com
Thu Mar 1 06:15:00 PST 2012
Hi,
I have defined this struct
struct preEv {
string edate; //010112
string etime; //00:00:00
string etext; //
SysTime esystime;
this (this) {
SysTime esystime = SysTime(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])));
}
}
If I write to the sctruct and then print it I'm able to see the
SysTime variable with a value.
writeln(preEv) //previousEvents("140212", "05:13:26", "9 140212
05:13:26 d", "2012-Feb-14 05:13:26")
but if trying to get the value from the SysTime variable I get a
Segmentation fault. Trying to read any other variable inside this
struct will not be a problem.
writeln (preEv.esystime.day) // will compile but segfaults
On DMD32 D Compiler v2.058
Any correct way to do this?
Thank you.
More information about the Digitalmars-d-learn
mailing list