1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #include "base/datetime.hpp"
4 #include "base/function.hpp"
5 #include "base/functionwrapper.hpp"
6 #include "base/scriptframe.hpp"
7 #include "base/objectlock.hpp"
9 using namespace icinga;
11 static String DateTimeFormat(const String& format)
13 ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
14 DateTime::Ptr self = static_cast<DateTime::Ptr>(vframe->Self);
15 REQUIRE_NOT_NULL(self);
17 return self->Format(format);
20 Object::Ptr DateTime::GetPrototype()
22 static Dictionary::Ptr prototype = new Dictionary({
23 { "format", new Function("DateTime#format", DateTimeFormat, { "format" }) }