Beispiel #1
0
/**
 * @brief convert a time value to date and time string
 */
char *_win_ctime_r(const time_t *clock, char *buf)
{
  if (_plibc_utf8_mode == 1)
  {
    wchar_t *ret;
    char *retu = NULL;
    int r;
    ret = _wasctime(localtime(clock));
    if (!ret)
      return NULL;
    r = wchartostr (ret, &retu, CP_UTF8);
    free (ret);
    if (r < 0)
      return NULL;
    if (retu)
    {
      strcpy (buf, retu);
      retu = buf;
    }
    return retu;
  }
  else
  {
    char *ret;
    ret = asctime(localtime(clock));
    if (ret != NULL)
    {
      strcpy(buf, ret);
      ret = buf;
    }
    return ret;
  }
}
Beispiel #2
0
/**
 * @brief convert a time value to date and time string
 */
char *_win_ctime(const time_t *clock)
{
  if (_plibc_utf8_mode == 1)
  {
    char *timeu = NULL;
    wchar_t *timew = _wasctime (localtime (clock));
    if (!timew)
      return NULL;
    wchartostr (timew, &timeu, CP_UTF8);
    free (timew);
    /* in case of error timeu stays NULL */
    return timeu;
  }
  else
    return asctime(localtime(clock));
}
Beispiel #3
0
void LogSpamToFile(HANDLE hContact, tstring message)
{
	if (!gbLogToFile) return;

	tstring LogStrW, LogTime, LogProtocol, LogContactId, LogContactName;
	tstring filename;
	std::fstream file;
	TCHAR pszName[MAX_PATH];

	if (hStopSpamLogDirH)
		FoldersGetCustomPathT(hStopSpamLogDirH, pszName, MAX_PATH, _T(""));
	else
		lstrcpyn(pszName, VARST( _T("%miranda_logpath%")), SIZEOF(pszName));

	filename = pszName;
	filename = filename + _T("\\stopspam_mod.log");

	file.open(filename.c_str(),std::ios::out |std::ios::app);

	// Time Log line
	time_t time_now;
	tm   *TimeNow;
	time(&time_now);
	TimeNow = localtime(&time_now);
	LogTime=_wasctime( TimeNow );
	// Time Log line

	// Name, UID and Protocol Log line
	LogProtocol=DBGetContactSettingStringPAN(hContact,"Protocol","p",_T(""));
	LogContactName=(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR);
	LogContactId=(LogProtocol==_T(""))?_T(""):GetContactUid(hContact,LogProtocol);
	// Name, UID  and Protocol Log line

	LogStrW=_T("[")+LogTime.substr(0,LogTime.length()-1)+_T("] ")+
		LogContactId+_T(" - ")+
		LogContactName+_T(" (")+
		LogProtocol+_T("): ")+
		message+_T("\n");

	char * buf=mir_u2a(LogStrW.c_str());
	file.write(buf,LogStrW.length());
	mir_free(buf);

	file.close();
}
Beispiel #4
0
	static char_t* asctime(const tm* p) {
		return _wasctime(p);
	}