Constructor(Year as Integer, Month as Integer, Day as Integer, hour as Integer, minute as Integer, second as Integer)
this one works:
Constructor(Year as Integer, Month as Integer, Day as Integer, Hour as Integer, Minute as Integer, Second as Integer, GMTOffset as Double)
I am sorry for my incomplete posting.
This is a question for C++ developers writing plugins.
My code looks like this:
typedef void (*Func)(REALobject o, RBInteger y, RBInteger m, RBInteger d, RBInteger h, RBInteger i, RBInteger s);
Func f2 = (Func) REALLoadObjectMethod(o, "Constructor(Year as Integer, Month as Integer, Day as Integer, hour as Integer, minute as Integer, second as Integer)");
this fails.
And this works:
typedef void (*Func)(REALobject o, RBInteger y, RBInteger m, RBInteger d, RBInteger h, RBInteger i, RBInteger s, double g);
Func f1 = (Func) REALLoadObjectMethod(o, "Constructor(Year as Integer, Month as Integer, Day as Integer, Hour as Integer, Minute as Integer, Second as Integer, GMTOffset as Double)");
But I’d like to set dates sometimes without an explicit time zone.
But without putting the GMTOffset how can you create a valid date?
In Xojo if you don’t put the GMTOffset the date is created with the system GMTOffset:
Dim d As New date(2019, 4, 6, 7, 49, 53)
Dim d2 As Double
d2 = d.GMTOffset
So my guess, even if I use the creator without the GMTOffset, the date is created with the system GMTOffset. If no GMTOffset is explicitly set then you need to use the system one to use is as the implicit GMTOffset, no?
Edit: maybe the Date.Constructor is really:
Date.Constructor(Year as Integer, Month as Integer = 1, Day as Integer = 1, hour as Integer = 0, minute as Integer = 0, second as Integer = 0, GMTOffset as double = systemoffset)
What I’m trying to say is that even Xojo use the GMT offset (system) even if I don’t supply one, so I don’t know why you trying to use a constructor without GMT offset when it is needed to create a valid date. At least that’s how I look at it.
Try these signatures (your remark is academic in nature)
Constructor(Year as Integer, Month as Integer = 1, Day as Integer = 1, hour as Integer = 0, minute as Integer = 0, second as Integer = 0, GMTOffset as double)
Constructor(Year as Integer, Month as Integer = 1, Day as Integer = 1, hour as Integer = 0, minute as Integer = 0, second as Integer = 0)
Most likely, the second one won’t work either, so the first one might likely be defined by setting the default value of the GMTOffset:
Constructor(Year as Integer, Month as Integer = 1, Day as Integer = 1, hour as Integer = 0, minute as Integer = 0, second as Integer = 0, GMTOffset as double = 0.0)
Indicating that Xojo, under the hood, has the “Constructor”, the copy constructor and the long form of the constructor, not the one you want.
Maybe because that constructor is not valid and is missing the GMTOffset?
Sorry, this is the last time I post here, I have only ideas and not experience and may end offending someone. It is just clear to me why without the GMTOffset doesn’t work and with it, it works.