Пример #1
0
void main(int argc, char *argv[])
{
 clock_t start, finish;
 unsigned long duration;
 char desti[10];
 if(argc<=1)
 {
  printf("CHRONO par Herve Thouzard\nUtilisation : CHRONO programme.ext\n");
  exit(1);
 }
 start = clock();
 system(argv[1]);
 finish = clock();
 duration = (unsigned long)(finish - start) / CLOCKS_PER_SEC;
 printf("Temps d'execution : %s\n",SecToTime(desti,duration));
}
Пример #2
0
inline std::wstring lines::MetaWord(const std::wstring &word)
{
    if (word == __T("%curtime%"))
    {
        int res = SendMessage(m_hwnd,WM_WA_IPC,0,IPC_GETOUTPUTTIME);
        if (res == -1)
            return __T("~");
        return SecToTime(res/1000);
    }

    if (word == __T("%timeleft%"))
    {
        int cur = SendMessage(m_hwnd,WM_WA_IPC,0,IPC_GETOUTPUTTIME);
        int tot = SendMessage(m_hwnd,WM_WA_IPC,1,IPC_GETOUTPUTTIME);
        if (cur == -1 || tot == -1)
            return __T("~");
        return SecToTime(tot - cur / 1000);
    }

    if (word == __T("%totaltime%"))
    {
        int res = SendMessage(m_hwnd,WM_WA_IPC,1,IPC_GETOUTPUTTIME);
        if (res == -1)
            return __T("");
        return SecToTime(res);
    }

    if (word == __T("%kbps%"))
    {
        int inf=SendMessage(m_hwnd,WM_WA_IPC,1,IPC_GETINFO);
        if (inf == NULL)
            return std::wstring(__T(""));
        std::wstringstream w;
        w << inf;
        return w.str();
    }

    if (word == __T("%khz%"))
    {
        int inf=SendMessage(m_hwnd,WM_WA_IPC,0,IPC_GETINFO);
        if (inf == NULL)
            return std::wstring(__T(""));
        std::wstringstream w;
        w << inf;
        return w.str();
    }

    if (word == __T("%c%"))
        return __T("‡center‡");

    if (word == __T("%l%"))
        return __T("‡largefont‡");

    if (word == __T("%f%"))
        return __T("‡forceleft‡");

    if (word == __T("%s%"))
        return __T("‡shadow‡");

    if (word == __T("%b%"))
        return __T("‡darkbox‡");

    if (word == __T("%d%"))
        return __T("‡dontscroll‡");

    if (word == __T("%volume%"))
    {
        std::wstringstream w;
        w << (m_settings.play_volume * 100) /255;
        return w.str();
    }

    if (word == __T("%shuffle%"))
    {
        static wchar_t tmp[8];
        return WASABI_API_LNGSTRINGW_BUF((SendMessage(m_hwnd,WM_WA_IPC,0,IPC_GET_SHUFFLE)?IDS_ON:IDS_OFF),tmp,8);
    }

    if (word == __T("%repeat%"))
    {
        static wchar_t tmp[8];
        return WASABI_API_LNGSTRINGW_BUF((SendMessage(m_hwnd,WM_WA_IPC,0,IPC_GET_REPEAT)?IDS_ON:IDS_OFF),tmp,8);
    }

    if (word == __T("%curpl%"))
    {
        std::wstringstream w;
        w << (SendMessage(m_hwnd,WM_WA_IPC,0,IPC_GETLISTLENGTH)? m_settings.play_playlistpos+1 : 0);
        return w.str();
    }

    if (word == __T("%totalpl%"))
    {
        std::wstringstream w;
        w << SendMessage(m_hwnd,WM_WA_IPC,0,IPC_GETLISTLENGTH);
        return w.str();
    }

    if (word == __T("%rating1%") || word == __T("%rating2%"))
    {
        std::wstringstream w;
        int x = SendMessage(m_hwnd,WM_WA_IPC,0,IPC_GETRATING);
        if (word == __T("%rating1%"))
            w << x;
        else
        {
            for (int i=0; i < x; i++)
                w << L"\u2605";
            for (int i=0; i < 5-x; i++)
                w << L"\u2606"/*" \u25CF"*/;
        }
        return w.str();
    }

    return m_metadata.getMetadata(word.substr(1, word.length()-2));
}