~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/blenlib/intern/time.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
double PIL_check_seconds_timer(void) 
39
39
{
40
 
        static int hasperfcounter= -1; /* -1==unknown */
 
40
        static int hasperfcounter = -1; /* (-1 == unknown) */
41
41
        static double perffreq;
42
42
 
43
 
        if (hasperfcounter==-1) {
 
43
        if (hasperfcounter == -1) {
44
44
                __int64 ifreq;
45
 
                hasperfcounter= QueryPerformanceFrequency((LARGE_INTEGER*) &ifreq);
46
 
                perffreq= (double) ifreq;
47
 
        } 
 
45
                hasperfcounter = QueryPerformanceFrequency((LARGE_INTEGER *) &ifreq);
 
46
                perffreq = (double) ifreq;
 
47
        }
48
48
 
49
49
        if (hasperfcounter) {
50
50
                __int64 count;
51
51
 
52
 
                QueryPerformanceCounter((LARGE_INTEGER*) &count);
 
52
                QueryPerformanceCounter((LARGE_INTEGER *) &count);
53
53
 
54
 
                return count/perffreq;
 
54
                return count / perffreq;
55
55
        }
56
56
        else {
57
 
                static double accum= 0.0;
58
 
                static int ltick= 0;
59
 
                int ntick= GetTickCount();
 
57
                static double accum = 0.0;
 
58
                static int ltick = 0;
 
59
                int ntick = GetTickCount();
60
60
 
61
 
                if (ntick<ltick) {
62
 
                        accum+= (0xFFFFFFFF-ltick+ntick)/1000.0;
 
61
                if (ntick < ltick) {
 
62
                        accum += (0xFFFFFFFF - ltick + ntick) / 1000.0;
63
63
                }
64
64
                else {
65
 
                        accum+= (ntick-ltick)/1000.0;
 
65
                        accum += (ntick - ltick) / 1000.0;
66
66
                }
67
67
 
68
 
                ltick= ntick;
 
68
                ltick = ntick;
69
69
                return accum;
70
70
        }
71
71
}
87
87
 
88
88
        gettimeofday(&tv, &tz);
89
89
 
90
 
        return ((double) tv.tv_sec + tv.tv_usec/1000000.0);
 
90
        return ((double) tv.tv_sec + tv.tv_usec / 1000000.0);
91
91
}
92
92
 
93
93
void PIL_sleep_ms(int ms)
94
94
{
95
 
        if (ms>=1000) {
96
 
                sleep(ms/1000);
97
 
                ms= (ms%1000);
 
95
        if (ms >= 1000) {
 
96
                sleep(ms / 1000);
 
97
                ms = (ms % 1000);
98
98
        }
99
99
        
100
 
        usleep(ms*1000);
 
100
        usleep(ms * 1000);
101
101
}
102
102
 
103
103
#endif