本文整理汇总了C++中CDateTime::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ CDateTime::getString方法的具体用法?C++ CDateTime::getString怎么用?C++ CDateTime::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDateTime
的用法示例。
在下文中一共展示了CDateTime::getString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkFilePart
void checkFilePart(IChecker *checker,IDistributedFilePart *part,bool blocked)
{
StringBuffer tmp;
checker->add("getPartIndex",part->getPartIndex());
unsigned n = part->numCopies();
checker->add("numCopies",part->numCopies());
checker->add("maxCopies",n);
RemoteFilename rfn;
for (unsigned copy=0;copy<n;copy++) {
INode *node = part->queryNode(copy);
if (node)
checker->add(copy,"queryNode",node->endpoint().getUrlStr(tmp.clear()).str());
else
checker->error("missing node");
checker->add(copy,"getFilename",part->getFilename(rfn,copy).getRemotePath(tmp.clear()).str());
}
checker->add("getPartName",part->getPartName(tmp.clear()).str());
#ifndef COMPAT
checker->add("getPartDirectory",part->getPartDirectory(tmp.clear()).str());
#endif
checker->add("queryProperties()",toXML(&part->queryAttributes(),tmp.clear()).str());
checker->add("isHost",part->isHost()?1:0);
checker->add("getFileSize",part->getFileSize(false,false));
CDateTime dt;
if (part->getModifiedTime(false,false,dt))
dt.getString(tmp.clear());
else
tmp.clear().append("nodatetime");
checker->add("getModifiedTime",tmp.str());
unsigned crc;
if (part->getCrc(crc)&&!blocked)
checker->add("getCrc",crc);
else
checker->add("getCrc","nocrc");
}
示例2: onMyAccount
bool Cws_accountEx::onMyAccount(IEspContext &context, IEspMyAccountRequest &req, IEspMyAccountResponse &resp)
{
try
{
ISecUser* user = context.queryUser();
if(user != NULL)
{
CDateTime dt;
user->getPasswordExpiration(dt);
StringBuffer sb;
if (dt.isNull())
sb.append("Never");
else
{
dt.getString(sb);
sb.replace('T', (char)0);//chop off timestring
}
resp.setPasswordExpiration(sb.str());
resp.setPasswordDaysRemaining(user->getPasswordDaysRemaining());
resp.setFirstName(user->getFirstName());
resp.setLastName(user->getLastName());
resp.setUsername(user->getName());
}
}
catch(IException* e)
{
FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR);
}
return true;
}
示例3: initDefaultValues
void MessageGenerator::initDefaultValues()
{
char dbuf[64];
CDateTime now;
now.setNow();
StringBuffer nowstr;
now.getString(nowstr, true);
unsigned y, m, d;
now.getDate(y, m, d, true);
unsigned h, minute, s, nano;
now.getTime(h, minute, s, nano, true);
m_defaultvalues["string"] = "string";
m_defaultvalues["boolean"] = "1";
m_defaultvalues["decimal"] = "3.1415926535897932384626433832795";
m_defaultvalues["float"] = "3.14159";
m_defaultvalues["double"] = "3.14159265358979";
m_defaultvalues["duration"] = "P1Y2M3DT10H30M";
m_defaultvalues["dateTime"] = nowstr.str();
sprintf(dbuf, "%02d:%02d:%02d", h,minute,s);
m_defaultvalues["time"] = dbuf;
sprintf(dbuf, "%04d-%02d-%02d", y, m, d);
m_defaultvalues["date"] = dbuf;
sprintf(dbuf, "%04d-%02d", y, m);
m_defaultvalues["gYearMonth"] = dbuf;
sprintf(dbuf, "%04d", y);
m_defaultvalues["gYear"] = dbuf;
sprintf(dbuf, "--%02d-%02d", m, d);
m_defaultvalues["gMonthDay"] = dbuf;
sprintf(dbuf, "---%02d", d);
m_defaultvalues["gDay"] = dbuf;
sprintf(dbuf, "--%02d--", m);
m_defaultvalues["gMonth"] = dbuf;
m_defaultvalues["hexBinary"] = "A9D4C56EFB";
m_defaultvalues["base64Binary"] = "YmFzZTY0QmluYXJ5";
m_defaultvalues["anyURI"] = "http://anyURI/";
m_defaultvalues["QName"] = "q:name";
m_defaultvalues["NOTATION"] = "NOTATION";
m_defaultvalues["normalizedString"] = "normalizedString";
m_defaultvalues["token"] = "token";
m_defaultvalues["language"] = "en-us";
m_defaultvalues["integer"] = "0";
m_defaultvalues["nonPositiveInteger"] = "-1";
m_defaultvalues["negativeInteger"] = "-2";
m_defaultvalues["long"] = "2147483647";
m_defaultvalues["int"] = "32716";
m_defaultvalues["short"] = "4096";
m_defaultvalues["byte"] = "127";
m_defaultvalues["nonNegativeInteger"] = "3";
m_defaultvalues["positiveInteger"] = "2";
m_defaultvalues["unsignedLong"] = "4294967295";
m_defaultvalues["unsignedInt"] = "4";
m_defaultvalues["unsignedShort"] = "65535";
m_defaultvalues["unsignedByte"] = "255";
}
示例4: querySDS
CSDSServerStatus::CSDSServerStatus(const char *servername)
{
conn = querySDS().connect("Status/Servers/Server", myProcessSession(), RTM_CREATE_ADD | RTM_LOCK_READ | RTM_DELETE_ON_DISCONNECT, 5*60*1000);
if (conn) {
IPropertyTree &root = *conn->queryRoot();
root.setProp("@name",servername);
StringBuffer node;
queryMyNode()->endpoint().getIpText(node);
root.setProp("@node",node.str());
root.setPropInt("@mpport",queryMyNode()->endpoint().port);
CDateTime dt;
dt.setNow();
StringBuffer str;
root.setProp("@started",dt.getString(str).str());
conn->commit();
}
}
示例5: CleanFiles
void CleanFiles()
{
//DBGLOG("directory len %d and ext len: %d",Directory.length(),Ext.length());
if (Directory.length() == 0 || Ext.length() == 0)
return;
CDateTime currentTime;
currentTime.setNow();
int fileCounter = 0;
// DBGLOG("Directory:%s for files of ext:%s",Directory.str(), Ext.str());
Owned<IDirectoryIterator> di = createDirectoryIterator(Directory.str(), Ext.str());
ForEach (*di)
{
IFile &file = di->query();
CDateTime createTime, modifiedTime,accessedTime;
file.getTime( &createTime, &modifiedTime, &accessedTime);
StringBuffer accessedTimeStr,currentTimeStr;
accessedTime.getString(accessedTimeStr);
accessedTime.adjustTime(+m_CacheTimeoutPeriod);
accessedTimeStr.clear();
accessedTime.getString(accessedTimeStr);
currentTime.getString(currentTimeStr);
if (accessedTime.compare(currentTime) < 0)
{
const char* fileName = file.queryFilename();
DBGLOG("Trying to remove:%s",fileName);
if (file.exists() == true)
{
fileCounter++;
bool bDeleteOk = file.remove();
if (!bDeleteOk)
WARNLOG("ERROR Removing old cache file %s",fileName);
}
}
}
}
示例6: checkFile
void checkFile(IChecker *checker,IDistributedFile *file)
{
StringBuffer tmp;
checker->add("queryLogicalName",file->queryLogicalName());
unsigned np = file->numParts();
checker->add("numParts",np);
checker->add("queryDefaultDir",file->queryDefaultDir());
if (np>1)
checker->add("queryPartMask",file->queryPartMask());
checker->add("queryProperties()",toXML(&file->queryAttributes(),tmp.clear()).str());
CDateTime dt;
if (file->getModificationTime(dt))
dt.getString(tmp.clear());
else
tmp.clear().append("nodatetime");
// Owned<IFileDescriptor> desc = getFileDescriptor();
// checkFileDescriptor(checker,desc);
//virtual bool existsPhysicalPartFiles(unsigned short port) = 0; // returns true if physical patrs all exist (on primary OR secondary)
//Owned<IPropertyTree> tree = getTreeCopy();
//checker->add("queryProperties()",toXML(tree,tmp.clear()).str());
checker->add("getFileSize",file->getFileSize(false,false));
bool blocked;
checker->add("isCompressed",file->isCompressed(&blocked)?1:0);
checker->add("blocked",blocked?1:0);
unsigned csum;
if (file->getFileCheckSum(csum)&&!blocked)
checker->add("getFileCheckSum",csum);
else
checker->add("getFileCheckSum","nochecksum");
checker->add("isSubFile",file->isSubFile()?1:0);
StringBuffer clustname;
checker->add("queryClusterName(0)",file->getClusterName(0,clustname).str());
for (unsigned i=0;i<np;i++) {
Owned<IDistributedFilePart> part = file->getPart(i);
if (part)
checkFilePart(checker,part,blocked);
}
}
示例7: doSingleSwapNode
bool doSingleSwapNode(const char *oldip,const char *newip,unsigned nodenum,IPropertyTree *info,const char *timechecked)
{
if (doSwap(oldip,newip)) {
if (info) {
StringBuffer times(timechecked);
if (times.length()==0) {
CDateTime dt;
dt.setNow();
dt.getString(times);
}
// TBD tie up with bad node in auto?
IPropertyTree *swap = info->addPropTree("Swap",createPTree("Swap"));
swap->setProp("@inNetAddress",newip);
swap->setProp("@outNetAddress",oldip);
swap->setProp("@time",times.str());
if (UINT_MAX != nodenum)
swap->setPropInt("@rank",nodenum-1);
}
return true;
}
return false;
}
示例8: addTask
//---------------------------------------------------------------------------
// addTask
//---------------------------------------------------------------------------
IPropertyTree* addTask(IDeployTask& task)
{
// Get or add Component node
IPropertyTree* compNode = addComponent(task.getCompName());
assertex(compNode);
// Get Tasks node
IPropertyTree* tasksNode = compNode->queryPropTree("Tasks");
assertex(tasksNode);
// Add new task
IPropertyTree* node = createPTree("Task");
node->addProp("@action", task.getCaption());
node->addProp("@source", task.getFileSpec(DT_SOURCE));
node->addProp("@target", task.getFileSpec(DT_TARGET));
CDateTime modifiedTime;
Owned<IFile> pTargetFile = createIFile(task.getFileSpec(DT_TARGET));
if (pTargetFile->getTime(NULL, &modifiedTime, NULL))
{
StringBuffer timestamp;
modifiedTime.getString(timestamp);
offset_t filesize = pTargetFile->size();
node->addProp("@date", timestamp.str());
node->addPropInt64("@size", filesize);
}
if (task.getErrorCode())
{
node->addProp("@error", task.getErrorString());
compNode->setProp("@error", "true");
}
return tasksNode->addPropTree("Task", node);
}
示例9: readSessionTimeStamp
const char* CWSESPControlEx::readSessionTimeStamp(int t, StringBuffer& str)
{
CDateTime time;
time.set(t);
return time.getString(str).str();
}