MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / rig_check_cache_timeout

Function rig_check_cache_timeout

src/misc.c:1860–1895  ·  view source on GitHub ↗

* \brief Helper for checking cache timeout * \param tv pointer to timeval, date of cache * \param timeout duration of cache validity, in millisec * \return 1 when timed out, 0 when cache shall be used */

Source from the content-addressed store, hash-verified

1858 * \return 1 when timed out, 0 when cache shall be used
1859 */
1860int HAMLIB_API rig_check_cache_timeout(const struct timeval *tv, int timeout)
1861{
1862 struct timeval curr;
1863 long t;
1864
1865 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
1866
1867 if (tv->tv_sec == 0 && tv->tv_usec == 0)
1868 {
1869 rig_debug(RIG_DEBUG_VERBOSE,
1870 "%s: forced cache timeout\n",
1871 __func__);
1872 return 1;
1873 }
1874
1875 gettimeofday(&curr, NULL);
1876
1877 t = timediff(&curr, tv);
1878
1879 if (t < timeout)
1880 {
1881 rig_debug(RIG_DEBUG_VERBOSE,
1882 "%s: using cache (%ld ms)\n",
1883 __func__,
1884 t);
1885 return 0;
1886 }
1887 else
1888 {
1889 rig_debug(RIG_DEBUG_VERBOSE,
1890 "%s: cache timed out (%ld ms)\n",
1891 __func__,
1892 t);
1893 return 1;
1894 }
1895}
1896
1897
1898/**

Callers 6

ra37xx_one_transactionFunction · 0.85
ft747_get_update_dataFunction · 0.85
ft980_get_status_dataFunction · 0.85
prm80_read_system_stateFunction · 0.85
tt585_get_status_dataFunction · 0.85
ars_set_position_syncFunction · 0.85

Calls 3

rig_debugFunction · 0.85
gettimeofdayFunction · 0.85
timediffFunction · 0.70

Tested by

no test coverage detected