npy_int64 get_python_ordinal(npy_int64 period_ordinal, int freq) { asfreq_info af_info; npy_int64 (*toDaily)(npy_int64, char, asfreq_info*); if (freq == FR_DAY) return period_ordinal + ORD_OFFSET; toDaily = get_asfreq_func(freq, FR_DAY); get_asfreq_info(freq, FR_DAY, &af_info); return toDaily(period_ordinal, 'E', &af_info) + ORD_OFFSET; }
int64_t get_python_ordinal(int64_t period_ordinal, int freq) { asfreq_info af_info; int64_t (*toDaily)(int64_t, char, asfreq_info*); if (freq == FR_DAY) return period_ordinal; toDaily = get_asfreq_func(freq, FR_DAY, 0); get_asfreq_info(freq, FR_DAY, &af_info); return toDaily(period_ordinal, 'E', &af_info); }
npy_int64 get_python_ordinal(npy_int64 period_ordinal, int freq) { asfreq_info af_info; freq_conv_func toDaily = NULL; if (freq == FR_DAY) return period_ordinal + ORD_OFFSET; toDaily = get_asfreq_func(freq, FR_DAY); get_asfreq_info(freq, FR_DAY, &af_info); return toDaily(period_ordinal, 'E', &af_info) + ORD_OFFSET; }
long_t get_python_ordinal(long_t period_ordinal, int freq) { if (freq == FR_DAY) return period_ordinal; long_t (*toDaily)(long_t, char, asfreq_info*) = NULL; asfreq_info af_info; toDaily = get_asfreq_func(freq, FR_DAY, 0); get_asfreq_info(freq, FR_DAY, &af_info); return toDaily(period_ordinal, 'E', &af_info); }
long get_python_ordinal(long skts_ordinal, int freq) { if (freq == FR_DAY) return skts_ordinal; long (*toDaily)(long, char, asfreq_info*) = NULL; asfreq_info af_info; toDaily = get_asfreq_func(freq, FR_DAY, 0); get_asfreq_info(freq, FR_DAY, &af_info); return toDaily(skts_ordinal, 'E', &af_info); }
long resample(long skts_ordinal, int freq1, int freq2, char relation) { freq_conv_func func = get_asfreq_func(freq1, freq2, 0); asfreq_info finfo; get_asfreq_info(freq1, freq2, &finfo); long val = (*func)(skts_ordinal, relation, &finfo); if (val == INT_ERR_CODE) Py_Error(PyExc_ValueError, "Unable to convert to desired frequency."); return val; onError: return INT_ERR_CODE; }
long_t asfreq(long_t period_ordinal, int freq1, int freq2, char relation) { freq_conv_func func = get_asfreq_func(freq1, freq2, 0); asfreq_info finfo; get_asfreq_info(freq1, freq2, &finfo); long_t val = (*func)(period_ordinal, relation, &finfo); if (val == INT_ERR_CODE) { Py_Error(PyExc_ValueError, "Unable to convert to desired frequency."); goto onError; } return val; onError: return INT_ERR_CODE; }
npy_int64 asfreq(npy_int64 period_ordinal, int freq1, int freq2, char relation) { npy_int64 val; freq_conv_func func; asfreq_info finfo; func = get_asfreq_func(freq1, freq2); get_asfreq_info(freq1, freq2, &finfo); val = (*func)(period_ordinal, relation, &finfo); if (val == INT_ERR_CODE) { // Py_Error(PyExc_ValueError, "Unable to convert to desired frequency."); goto onError; } return val; onError: return INT_ERR_CODE; }