1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #include "sync_helper.h"
- long long host_server::sync_helper::parse_time(const char * c)
- {
- long long ttt0 = (((long long)(c[0]))<<32) & (0x000000FF00000000);
- long long ttt1 = (((long long)(c[1]))<<24) & (0x00000000FF000000);
- long long ttt2 = (((long long)(c[2]))<<16) & (0x0000000000FF0000);
- long long ttt3 = (((long long)(c[3]))<<8) & (0x000000000000FF00);
- long long all = ttt0 + ttt1 + ttt2 + ttt3 + ((long long)(c[4]&(0xFF)));
- return all;
- }
- unsigned long long host_server::sync_helper::parse_id(unsigned int id, unsigned char antNum)
- {
- return (id << 8) + antNum;
- }
- unsigned long long host_server::sync_helper::parse_from_fstream(ifstream &f, int size)
- {
- unsigned long long x(0);
- for(int i(0); i < size; i++)
- {
- int t;
- f >> hex >> t;
- x = (x << 8) + t;
- }
- return x;
- }
- unsigned long long host_server::sync_helper::parse_time_from_fstream(ifstream &f)
- {
- char* t = new char[5];
- for (int i = 0; i < 5; i++)
- {
- int tmp;
- f >> hex >> tmp;
- t[i] = tmp;
- }
- auto time = sync_helper::parse_time(t);
- delete[] t;
- return time;
- }
|