Changeset 5031:ebd6fe192503 in roaraudio for roard/req.c
- Timestamp:
- 05/28/11 14:23:32 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/req.c
r4949 r5031 682 682 #endif 683 683 684 int req_on_gettimeofday (int client, struct roar_message * mes, char ** data, uint32_t flags[2]) { 685 #if defined(ROAR_HAVE_GETTIMEOFDAY) || defined(ROAR_HAVE_TIME) 686 struct roar_time curtime; 687 #ifdef ROAR_HAVE_GETTIMEOFDAY 688 struct timeval tv; 689 #elif defined(ROAR_HAVE_TIME) 690 time_t now = time(NULL); 691 #endif 692 693 ROAR_DBG("req_on_gettimeofday(client=%i, mes=%p, data=%p, flags=%p) = ?", client, mes, data, flags); 694 695 if ( *data != NULL ) { 696 return -1; 697 } 698 699 ROAR_DBG("req_on_gettimeofday(client=%i, mes=%p, data=%p, flags=%p) = ?", client, mes, data, flags); 700 701 if ( mes->datalen && mes->datalen < 8 ) { 702 return -1; 703 } 704 705 ROAR_DBG("req_on_gettimeofday(client=%i, mes=%p, data=%p, flags=%p) = ?", client, mes, data, flags); 706 707 if ( mes->datalen >= 8 ) { 708 if ( *(uint64_t *)mes->data != 0 ) { 709 return -1; 710 } 711 } 712 713 ROAR_DBG("req_on_gettimeofday(client=%i, mes=%p, data=%p, flags=%p) = ?", client, mes, data, flags); 714 715 memset(&curtime, 0, sizeof(curtime)); 716 717 #ifdef ROAR_HAVE_GETTIMEOFDAY 718 if ( gettimeofday(&tv, NULL) == -1 ) 719 return -1; 720 curtime.t_sec = tv.tv_sec; 721 curtime.t_ssec = (uint64_t)tv.tv_usec * (uint64_t)18446744073709ULL; 722 #elif defined(ROAR_HAVE_TIME) 723 curtime.t_sec = now; 724 #endif 725 726 if ( roar_time_to_msg(mes, &curtime) == -1 ) 727 return -1; 728 729 mes->cmd = ROAR_CMD_OK; 730 731 ROAR_DBG("req_on_gettimeofday(client=%i, mes=%p, data=%p, flags=%p) = ?", client, mes, data, flags); 732 733 return 0; 734 #else 735 return -1; 736 #endif 737 } 738 684 739 int req_on_server_info (int client, struct roar_message * mes, char ** data, uint32_t flags[2]) { 685 740 #ifdef ROAR_HAVE_UNAME
Note: See TracChangeset
for help on using the changeset viewer.